advanced sleep log warnings

37 views
Skip to first unread message

Erin MacIntyre

unread,
Dec 21, 2021, 5:46:43 PM12/21/21
to R package GGIR
Hello, 

Similar to previous posts, I am trying to integrate an advanced sleep log into my GGIR shell and am having some troubles. I was able to run my code with the basic log, but since changing to the advanced I'm unable to read it in properly. I have tried the trouble shooting previously described, but I am still stuck. I'm getting the following warnings: 

Error in `[<-`(`*tmp*`, cnt, 1, value = round(S[j, colid])) :
  subscript out of bounds

and 

In g.loadlog(loglocation = "/Users/.../diary.csv",  :
  NAs introduced by coercion


I have attached a copy of my sleep log and below is the code that I have been using: 


#########################################################################################
library(GGIR)
#########################################################################################
datadir = "/Users/.../RAW files"
outputdir= "/Users/.../Results"
desiredtz = "Australia/Adelaide"
########################################################################################
#G.PART1
########################################################################################
g.part1(datadir = datadir, outputdir = outputdir, f0 = 1, f1 = 5,
        windowsizes = c(5, 900, 3600),
        desiredtz = desiredtz, dynrange = 8,
        chunksize = 1,
        do.enmo = TRUE, do.anglez = TRUE,
        do.cal = TRUE,
        spherecrit = 0.3, minloadcrit = 72,
        printsummary = TRUE, print.filename = TRUE, overwrite = FALSE)
###############################################################################
#G.SHELL
###############################################################################
g.shell.GGIR(mode = 2:5,datadir = datadir,outputdir = outputdir,f0 = c(),f1 = c(),
             studyname = "XXX", overwrite = TRUE, do.report = c(2,4,5), visualreport = TRUE,
             myfun = myfun, do.parallel = FALSE, #for step count#
             #PART 2
             metadatadir = c(),
             strategy = 3,
             ndayswindow = 7,
             includedaycrit = 8,
             qlevels = c(0,0.1,0.2,0.25,0.3,0.4,0.5,0.6,0.7,0.75,0.8,0.9,1),
             ilevels = seq(0,400,by = 20),
             idloc = 2,
             do.imp = TRUE,
             epochvalues2csv = TRUE,
             desiredtz = desiredtz,
             dayborder = 12,
             bout.metric = 1,closedbout = F,
             iglevels = TRUE,
             #PART 3
             anglethreshold = 5,timethreshold = 5,
             ignorenonwear = TRUE, acc.metric = "ENMO", do.part3.pdf = TRUE,
             #PART 4,
             sleeplog = g.loadlog(loglocation = "/Users/.../diary.csv",
                       meta.sleep.folder = "/Users/.../meta/ms3.out",
                       nnights = 7,
                       sleeplogidnum = TRUE,
                       colid = 1,
                       coln1 = 2),
             do.visual = TRUE,
             outliers.only = FALSE,
             excludefirstlast = FALSE,
             includenightcrit = 8,
             storefolderstructure = TRUE,
             #PART 5,
             metadatadir = c(),
             strategy=3, ndayswindow = 7,
             excludefirstlast = FALSE,
             windowsizes = c(5,900,3600),
             storefolderstructure = TRUE,
             boutcriter.mvpa = 0.8, boutcriter.in = 0.9, boutcriter.lig = 0.8,
             threshold.lig = c(45), threshold.mod = c(100), threshold.vig = c(430),
             timewindow=c("MM"), winhr = c(5,10), M5L5res = 10,
             boutdur.mvpa = c(1,5,10), boutdur.in = c(10,20,30), boutdur.lig = c(1,5,10),
             desiredtz="Australia/Adelaide", bout.metric=4, dayborder = 12)

Please let me know if you need any additional information. Thanks in advance for your help! This is the first time I have worked with accelerometers and a novice, so any help is very much appreciated. 

Erin 

diary.csv

Vincent van Hees

unread,
Dec 23, 2021, 5:06:28 AM12/23/21
to Erin MacIntyre, R package GGIR
Hi Erin,
I think the problem is with your g.shell.GGIR call. You cannot provide "sleeplog = g.loadlog(loglocation = "/Users/.../diary.csv", ...." as an argument to g.shell.GGIR.

Instead please do:
g.shell.GGIR(.... all your other arguments.... ,
                     loglocation = "/Users/.../diary.csv", nnights = 7,
                       sleeplogidnum = TRUE,
                       colid = 1, coln1 = 2, do.visual =TRUE, .... and more arguments)

In other words meta.sleep.folder does not need to be specified for g.shell.GGIR and the other g.loadlog arguments need to be specified in g.shell.GGIR directly. No need to repeat "sleeplog = g.loadlog()".

Further, it may be good to mention that I merged the improvements that I referred to in recent weeks to the GitHub master branch. The latest GGIR version can now be installed with:

install.packages("remotes")
library(remotes)
remotes::install_github("wadpac/GGIR")

Best wishes,
Vincent

Dr. Vincent van Hees | Independent consultant | https://accelting.com/
image


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
--
You received this message because you are subscribed to the Google Groups "R package GGIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to RpackageGGIR...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/RpackageGGIR/d5205a21-f794-4d6b-b9ef-85d1a021a71dn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages