Advanced sleep log

170 views
Skip to first unread message

Callum Regan

unread,
Feb 24, 2025, 9:59:29 AM2/24/25
to R package GGIR
Hi all, 

I am trying to include a sleep log in my analyses to help identify non-wear times and did a trial test with just one participant. We have data on GT3X accelerometers that were worn on the hip for 7 days.


When I ran my script I received this warning message and didn't get any output:

Part 4 1Error in x[[jj]][iseq] <- vjj : replacement has length zero In addition: Warning messages: 1: In min(as.numeric(sleeplog$night)) : no non-missing arguments to min; returning Inf 2: In max(as.numeric(sleeplog$night)) : no non-missing arguments to max; returning -Inf

I am not sure why this message appears. I am using GGIR version 3.2-0.

I also tried to run the script where I removed any blank cells in the sleep log (participants have multiple time points in the day where they took off the accelerometer so there are multiple nonwear_off/on columns) and got the same warning message.

Attached is my script, the sleep log file and the R basic/meta file. 

Any help would be greatly appreciated, 

Many thanks 
Callum 

script.txt
meta_12_1 (2024-05-15).gt3x.RData
12_1_sleep.csv

Rechenberg Dresden

unread,
Mar 11, 2025, 10:10:37 AM3/11/25
to R package GGIR
Hi all,
I have exactly the same problem. I also use GGIR 3.2-0 in R4.4.2 and have a sleeplog with gaps (currently just for testing, but I'll probably fill it up with data once the script is running).
I would also be very happy to receive help.
Regarding this information x[[jj]][iseq] <- vjj I can't think of a logical explanation either.

Furthermore, I also have the messages for part6CR and part6HCA, although I have set to mode = c(1,2,3,4,5), and so only parts 1-5 should run and 6 should not run at all.

1Fehler in x[[jj]][iseq] <- vjj : Ersetzung hat Länge 0 Zusätzlich: Warnmeldungen: 1: Both part6CR and part6HCA are set to FALSE by which there is not analysis to be run in part 6. 2: Both part6CR and part6HCA are set to FALSE by which there is not analysis to be run in part 6. 3: In min(as.numeric(sleeplog$night)) : kein nicht-fehlendes Argument für min; gebe Inf zurück 4: In max(as.numeric(sleeplog$night)) : kein nicht-fehlendes Argument für max; gebe -Inf zurück

kind regards
Maximilian
Guider_pro - Kopie.csv

Rechenberg Dresden

unread,
Mar 12, 2025, 4:55:24 AM3/12/25
to R package GGIR
Hi Callum,
could it be that the problem is caused by the fact that D6 probably accidentally has D1 interspersed in the first line (see screenschot)?

Based on my research on the error, it seems to me that R is telling us here that the lists have different lengths.

Callum Regan schrieb am Montag, 24. Februar 2025 um 15:59:29 UTC+1:
Screenshot 2025-03-12 095216.png

Rechenberg Dresden

unread,
Mar 12, 2025, 8:43:32 AM3/12/25
to R package GGIR
I also got the problem solved, it was probably because I had labelled the column with date.. on the first line, but then didn't specify a date. In any case, I got it solved now. I think either you leave out the columns with dates you don't want to enter anything in, or you at least enter the date for each day (so for D1_date..... D2_date.... D3_date etc.) or you leave out the corresponding columns and jump directly from D1_date..... to D3_date (if you don't want to enter anything for D2).

What remains is the error message:
Warnmeldungen: 1: Both part6CR and part6HCA are set to FALSE by which there is not analysis to be run in part 6.
Does anyone else have an idea for this?

@Callum, Did you manage to solve your problem by customising the column headers?

Vincent van Hees

unread,
Mar 14, 2025, 12:30:16 PM3/14/25
to Rechenberg Dresden, R package GGIR
Hi Maximilian,

Column name elements like D1 D2 etc are all ignored by GGIR. GGIR only checks whether the column name has a known character pattern such as "date", "onset", "inbed" etc. So, you can add whatever text you like to the column names as long as it does not overlap with the terms GGIR is looking for, unless you want it to overlap.

Yes, dates are critical for the advanced sleeplog format to work, because how else can GGIR know to which date a time belongs. See documentation for details.

Your issue is different to the one by Callum.

Both part6CR and part6HCA are set to FALSE by which there is not analysis to be run in part 6.

This is a warning and NOT an error, I added it to the 3.2-0 release but accidentally it is also shown when part 6 is not run. This has now been fixed in the 3.2-1 release (GitHub only), but it does not affect your analysis. You can suppress the warning by setting part6CR = TRUE.

Best, Vincent

--
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, visit https://groups.google.com/d/msgid/RpackageGGIR/87a40bc1-229c-4090-989f-3f74c8c63c89n%40googlegroups.com.

Vincent van Hees

unread,
Mar 14, 2025, 12:30:16 PM3/14/25
to Callum Regan, R package GGIR
Hi Callum,

I see your sleep diary column names are wakeup and inbed, while you have left parameter sleepwindowType in the default "SPT" position, which means that GGIR expects column names "wakeup" and "sleeponset".

Either set parameter sleepwindowType = "TimeInBed" or change sleep diary column names to wakeup and sleeponset.

I will add a more readable error message in case others run into the same issue in the future.

Thanks,

Vincent

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

--
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.

Callum Regan

unread,
Mar 18, 2025, 3:53:13 AM3/18/25
to R package GGIR
Hi Vincent and Maximilian,

Thank you for the advice and sharing information. 

Great timing as I actually did resolve the problem by doing what you mentioned Vincent and changing the variable names to "wakeup" and "sleeponset" and it worked!

Thanks for pointing out the D1 and D6 error and for the tip regarding the warning message for part 6, I'll be sure to use  part6CR = TRUE.

Many thanks,

Callum 

Reply all
Reply to author
Forward
0 new messages