admin管理员组

文章数量:1405610

I am running GGIR version 3.2-0 on R version 4.4.2. I am using AX3 accelerometers for a study on cognition and sleep.

For the sake of simplicity, I'm using all the default parameters

GGIR(datadir="...", 
 outputdir="...")

Unfortunately four of my participants' devices were initialised (ie. recording started) on a laptop with the wrong timezone. The initialising computer time was set to GMT/UK time, whereas it should have been set to East Africa Time (EAT) - EAT was 3 hours ahead of GMT on the day this happened. The sleep/wake times are therefore 3 hours too early on the summary reports (eg. the output says the participant went to sleep at 9pm and woke up at 2am, whereas they actually went to sleep at 12pm and woke at 5am).

Is there any way to get GGIR to correct for this when analysing the data to produce summary results which reflect the sleep/wake times locally, rather than what the time was in London when they went to sleep/woke up?

I am running GGIR version 3.2-0 on R version 4.4.2. I am using AX3 accelerometers for a study on cognition and sleep.

For the sake of simplicity, I'm using all the default parameters

GGIR(datadir="...", 
 outputdir="...")

Unfortunately four of my participants' devices were initialised (ie. recording started) on a laptop with the wrong timezone. The initialising computer time was set to GMT/UK time, whereas it should have been set to East Africa Time (EAT) - EAT was 3 hours ahead of GMT on the day this happened. The sleep/wake times are therefore 3 hours too early on the summary reports (eg. the output says the participant went to sleep at 9pm and woke up at 2am, whereas they actually went to sleep at 12pm and woke at 5am).

Is there any way to get GGIR to correct for this when analysing the data to produce summary results which reflect the sleep/wake times locally, rather than what the time was in London when they went to sleep/woke up?

Share Improve this question asked Mar 22 at 13:34 Lachlan FotheringhamLachlan Fotheringham 11 bronze badge 6
  • Can't speak to GGIR specifically. If the raw data contains time stamps you could make the adjustment upon the default parameter output(s) with as.POSIXct(time stamp) + (3*60*60). Welcome to stackoverflow. – Chris Commented Mar 22 at 16:32
  • 1 Is it the case that the time is seemingly correct and the timezone is wrong, or that the time as shown on the console seems wrong but because it's a different timezone? What does attr(timestamp, "tzone") return, how is it shown on the console, and what should it look like? – r2evans Commented Mar 22 at 18:01
  • Thanks very much for the advice - @Chris I wasn't able to find a series of time stamps in the file. – Lachlan Fotheringham Commented Mar 27 at 9:50
  • @r2evans The time shown in the output was clearly incorrect (ie. at odds with the sleep diary) - offset by three hours. – Lachlan Fotheringham Commented Mar 27 at 9:52
  • I've been digging through the package documentation and found a solution. It's almost like the developer had this exact situation in mind. I added the following arguments to the GGIR function call - desiredtz = "Africa/Nairobi", configtz = "Europe/London". – Lachlan Fotheringham Commented Mar 27 at 9:55
 |  Show 1 more comment

1 Answer 1

Reset to default 0

I've found the answer in the package documentation. This solves the problem I had, where the computer initialising the tracker was in a different timezone (London), to the participant using the tracker (Nairobi). The resulting output using the code below showed the correct hours of waking/sleeping in the summary CSV

Overwrite = TRUE was required to reprocess the input files.

Please remember that stating the different times zones (as in the code below) will change the config file, which will keep these settings until you reset or change them. It's probably easiest to move to a different output folder for trackers in different time zones. This should revert to default settings.

GGIR(datadir="/my/path/input", 
     outputdir="/my/path/output",
     studyname = "My Study",
     overwrite = TRUE,
     desiredtz = "Africa/Nairobi",
     configtz = "Europe/London")

本文标签: rGGIRhow to correct for incorrect time zoneStack Overflow