dpwindred / sleepreg

Repository for 'sleepreg' package, for calculating Sleep Regularity Index scores from accelerometer or sleep diary data
GNU Lesser General Public License v3.0
11 stars 1 forks source link

Errors with 'SWS_from_binarySW' #7

Closed allthebestsxxx closed 4 months ago

allthebestsxxx commented 4 months ago

Hi, thanks for making this amazing package. I am trying to calculate SRI for .csv files generated from the Philips Actiware software. And I try to have some errors when I extract the SW

Here is my code:

SWS_from_binarySW(binarySWdir = "sri_path/", tsCol = c(2),binaryCol = c(1))

And what I get: <simpleError in if (sum(unique(diff(ts)) <= 0) > 0) { print(paste0("Error: ", fls_name[i], ". Timestamp column contains repeated or non-ordered values. This may arise due to daylight savings transition(s) contained within data converted from date-time to UNIX time.")) print(paste0("Check row: ", which(diff(ts) <= 0) + 1)) next}: missing value where TRUE/FALSE needed>

And I had checked the timestamp column there's no repeated or non-ordered values. Please see one of my sleep-wake files.

Could you please give me some suggestions about this error?

Thanks a lot, Zoe

example.csv

allthebestsxxx commented 4 months ago

The issue was fixed after I changed the class of timestamp column from 'Date' to 'Numeric'