Auto-updating back to SPT even though sleep log is supplied and option is set to TimeinBed

Skip to first unread message

Milan Zarchev

Dec 20, 2021, 8:58:51 AM12/20/21
to R package GGIR

I'm running into some trouble when trying to calculate the sleep efficiency metric. I have a sleep diary with time in bed data that I am able to read with no errors using the g.loadlog function (see attached script and sleep diary for 20 participants). However, when I supply the same sleep log to the GGIR main function and run the analyses, I get the message: 

Auto-updating sleepwindowType to SPT because nog sleeplog used and neither HASPT.algo HorAngle used.

It's weird because obviously the sleep log is not only loaded but also used, as the part4_nigtsummary output shows (sleeplog_used = 1 for all rows). So now I am completely confused as to why I GGIR is switching back to SPT and I do not get sleep efficiency metrics.

Additionally, I am also getting these error messages which could be relevant? 

In `[<-.factor`(`*tmp*`, iseq, value = "9.2625") :
  invalid factor level, NA generated

The same ones show up however when I am trying to just do the SPT analysis (I have a different diary for sleep time not time in bed) and everything seems in order there despite the errors.

Any help here would be very much appreciated!

Vincent van Hees

Dec 23, 2021, 5:08:14 AM12/23/21
to Milan Zarchev, R package GGIR
Sorry to hear that Milan,
This issue may have been fixed already. Can you try again with the latest development version. To install it, please run the following R commands:



Dr. Vincent van Hees | Independent consultant |

‐‐‐‐‐‐‐ 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
To view this discussion on the web, visit

Milan Zarchev

Dec 23, 2021, 5:27:31 AM12/23/21
to R package GGIR
Thank you for the help Vincent, its much appreciated! 

I will report on whether the development version solves this when I have access to my work computer early January.

Milan Zarchev

Jan 6, 2022, 5:47:37 AMJan 6
to R package GGIR
Just an update for anyone else that might be encountering a similar issue - Vincent's newest dev version of GGIR solves the issue and I am able to obtain sleep efficiency metrics now with the same code I used before. 

Thank you once again Vincent for your tireless work on developing and assisting with GGIR!


Reply all
Reply to author
0 new messages