Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set daysleep_offset default value #399

Merged
merged 9 commits into from
Feb 26, 2021
Prev Previous commit
Next Next commit
c() is NULL, which cannot be put into a vector; NA can be.
c() is equivalent to NULL, which is causing problems in the following line in `g.analyse.perfile.R`:

filesummary[vi:(vi+3)] = c(InterdailyStability, IntradailyVariability,
                               IVIS_windowsize_minutes, IVIS_epochsize_seconds)

The thing is, NULL is not allowed in a vector, and so it's getting ignored, and we end up with a vector size of 3 instead of 4. This causes a warning when Part2 is run:

"number of items to replace is not a multiple of replacement length"

NA doesn't have this problem and can be used to represent a missing value.
  • Loading branch information
l-k- committed Feb 26, 2021
commit 53c024e4949d92e93eaaa84b57d1f5b97aab2fcc
4 changes: 2 additions & 2 deletions R/g.IVIS.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
g.IVIS = function(Xi, epochsizesecondsXi = 5, IVIS_epochsize_seconds=c(), IVIS_windowsize_minutes = 60, IVIS.activity.metric = 1) {
if (!is.null(IVIS_epochsize_seconds)) {
g.IVIS = function(Xi, epochsizesecondsXi = 5, IVIS_epochsize_seconds=NA, IVIS_windowsize_minutes = 60, IVIS.activity.metric = 1) {
if (!is.na(IVIS_epochsize_seconds)) {
warning("Argument IVIS_epochsize_seconds has been depricated")
}
IVIS_epochsize_seconds = IVIS_windowsize_minutes*60
Expand Down
2 changes: 1 addition & 1 deletion R/g.part2.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ g.part2 = function(datadir=c(),metadatadir=c(),f0=c(),f1=c(),strategy = 1, hrs.d
boutcriter = 0.8,ndayswindow=7,idloc=1,do.imp=TRUE,storefolderstructure = FALSE,
overwrite=FALSE,epochvalues2csv=FALSE,mvpadur=c(1,5,10),selectdaysfile=c(),
window.summary.size=10,dayborder=0,bout.metric=2,closedbout=FALSE,desiredtz="",
IVIS_windowsize_minutes = 60, IVIS_epochsize_seconds = c(), iglevels = c(),
IVIS_windowsize_minutes = 60, IVIS_epochsize_seconds = NA, iglevels = c(),
IVIS.activity.metric=2, TimeSegments2ZeroFile=c(), qM5L5 = c(), do.parallel = TRUE,
myfun=c(), MX.ig.min.dur=10) {
snloc= 1
Expand Down
2 changes: 1 addition & 1 deletion R/g.shell.GGIR.R
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ g.shell.GGIR = function(mode=1:5,datadir=c(),outputdir=c(),studyname=c(),f0=1,f1
if (exists("ndayswindow") == FALSE) ndayswindow = 7
if (exists("do.imp") == FALSE) do.imp = TRUE
if (exists("IVIS_windowsize_minutes") == FALSE) IVIS_windowsize_minutes=60
if (exists("IVIS_epochsize_seconds") == FALSE) IVIS_epochsize_seconds=c()
if (exists("IVIS_epochsize_seconds") == FALSE) IVIS_epochsize_seconds=NA
if (exists("mvpadur") == FALSE) mvpadur = c(1,5,10) # related to part 2 (functionality to anticipate part 5)
if (length(mvpadur) != 3) {
mvpadur = c(1,5,10)
Expand Down
1 change: 0 additions & 1 deletion tests/testthat/test_part3_1_night.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ test_that("Part 3 identifies 1-night scenario", {
dn = "output_test"
if (file.exists(dn)) unlink(dn,recursive=TRUE)


# g.part# modules report errors and warnings only by printing them out to the console,
# so these are not true errors and warnings that would get caught by the testing module.
# Instead, grab the console output and parse out any errors we should know about.
Expand Down