Sleep log warnings

255 views
Skip to first unread message

Julia ZZ

unread,
Dec 1, 2021, 1:29:56 PM12/1/21
to R package GGIR
Hi all,

I am using advanced sleep log to process data. However, I met some warnings:

Warning 1: 
1: In `[<-.factor`(`*tmp*`, iseq, value = "-16.7236111111111") :
  invalid factor level, NA generated
The warning is similar as Sidney Donzella described and posted. I used the following codes but GGIR can load the file without problem: 
library(GGIR)
sleeplog = g.loadlog(loglocation="V:/.../v2/sleep_log_v2.csv",coln1=4, colid=1,nnights=50,sleeplogidnum=FALSE,  sleeplogsep=",",  meta.sleep.folder = "V:/.../meta/ms3.out")
print(head(sleeplog)
I also checked the ID names, they were the same as what part 2 summary showed. I wonder if anyone can give me some suggestion to fix the problem.

Warning 2:
41: In g.part4_extractid(idloc, fname = fnames[i], dolog,  ... :
Sleeplog id is stored as format: 1020RAW, while
                           code expects format: 1032RAW
42: In `[<-.factor`(`*tmp*`, iseq, value = "1032RAW") :
  invalid factor level, NA generated
I am confused by this warning and not sure what it means . Can anyone help me about it as well?

Thank you very much.

Sincerely,
Julia

Vincent van Hees

unread,
Dec 10, 2021, 9:14:03 AM12/10/21
to Julia ZZ, R package GGIR
Hi Julia,

Are you able to share with me for one individual in your dataset:
- The corresponding row in the sleeplog file and the first row, or just the entire sleeplog file if that is easier.
- The corresponding .RData milestone file as stored in the meta/basic folder?

Thanks, 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/5cecc8d3-c695-48c3-aed0-e963e7b7bf2bn%40googlegroups.com.

Xinting Yu

unread,
Dec 10, 2021, 11:42:08 PM12/10/21
to R package GGIR
Hi Vincent,
I have a similar issue when using advanced sleep log. I successfully got beautiful output using basic sleep log in GGIR shell. But I got errors when using advanced sleep log.
Here is the error when running shell:
Error in `[<-`(`*tmp*`, cnt, 1, value = as.character(S[j, colid])) :
  subscript out of bounds
Here is the error when running checking codes  sleeplog = g.loadlog(loglocation="//...../Sleeplogs/sleeplogs.csv",coln1=4, colid=1,nnights=9,sleeplogidnum=FALSE)
print(head(sleeplog)) :
Error in ID %in% startdates$ID : object 'startdates' not found
$sleeplog
      ID night         duration sleeponset sleepwake
1 XYtest     1 8.83333333333333    21:25:0    6:15:0
2 XYtest     2 9.33333333333333    23:10:0    8:30:0
3 XYtest     3             6.75    23:30:0    6:15:0
4 XYtest     4 7.51666666666667    23:40:0    7:11:0
5 XYtest     5              9.2    21:35:0    6:47:0
6 XYtest     6              8.5    22:30:0     7:0:0
7 XYtest     7 7.83333333333333    23:35:0    7:25:0
8 XYtest     8 8.28333333333333    22:30:0    6:47:0
9 XYtest     9 8.41666666666667     0:45:0    9:10:0

$nonwearlog
NULL

$naplog
NULL

$dateformat
[1] "%Y-%m-%d"

It seems nonwearlog and naplog were not successfully loaded.
I attached my advanced sleep log for this run. I cannot find .RData in the meta/basic folder but a .bin data. Do you need me to save a .RData from R studio? 

Thank you so much!!

Sincerely,
Xinting
sleeplogs.csv

Vincent van Hees

unread,
Dec 15, 2021, 10:40:29 AM12/15/21
to Xinting Yu, R package GGIR
Hi Xinting,

You are specifying both sleeponset and inbed. This is currently not possible you need to specify either "onset or in-bed time". Specifying both will confuse GGIR as we currently expect one window to be specified, which can either be a time in bed window a or a sleep period time window (onset-wakeup) window.

Best,
Vincent


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐

Xinting Yu

unread,
Dec 15, 2021, 3:37:12 PM12/15/21
to R package GGIR
Thank you so much for your advice, Vincent! Advanced sleep log using the calendar date would be very helpful for our data collection and data entry.
I corrected my sleep log and just kept in-bed time, but I still got the error indicating: Error in ID %in% startdates$ID : object 'startdates' not found.
Command:  sleeplog = g.loadlog(loglocation="//..../Sleeplogs/sleeplogs.csv",coln1=4, colid=1,nnights=9,sleeplogidnum=FALSE)
print(head(sleeplog))
I attached the sleep log. Also for the advanced log, should coln1 be indicating the column for the first day date (coln1=2) or the valid in-bed or wakeup time of the first day (for my test data coln1=4)?
I really appreciate your help.
Sincerely,
Xinting
sleeplogs.csv

Vincent van Hees

unread,
Dec 16, 2021, 2:59:00 AM12/16/21
to Xinting Yu, R package GGIR
Hi Xinting,

When testing your advanced sleeplog file with function g.loadlog directly you also need to specify argument meta.sleep.folder, which should point at the .../meta/ms3.out folder generated by GGIR. This is because GGIR uses those data to assess the relative timing of accelerometer recording to the sleeplog. For the basic sleeplog format argument meta.sleep.folder is not used.

Further, the coln1 is the column with the first date, which is column 2 in your case.

Kind regards, Vincent

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


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
Reply all
Reply to author
Forward
0 new messages