Dear all,
I’m trying to extract some physical activity parameters from the UK BioBank raw accelerometer data (AX3, .cwa format) using GGIR package (version 2.3.0). I’m wondering why the starting time of cwa file is different from the GGIR output. 15 minutes are missing of GGIR output. Does anyone has encountered a similar situation? Or maybe our parameter settings are wrong?
Take “accsamp.cwa” as an example.
(Sample datafile of accelerometer results “accsamp.cwa” is downloaded from https://biobank.ndph.ox.ac.uk/ukb/refer.cgi?id=131620)
I read the cwa file by g.cwaread function, and it shows that the start time is 2013-07-13 10:00:05.
t <- g.cwaread(fileName = dir, start = 0, end = 10, desiredtz = "Europe/London")
t$header$start
[1] "2013-07-13 10:00:05 BST"
t$data[1:3,]
# time x y z temp battery light
# 1 1373706006 -0.67187500 0.1250000 -1.2968750 17.9 4.101562 319
# 2 1373706006 -0.03182551 -0.1099505 0.8454765 17.9 4.101562 319
# 3 1373706006 -0.04572397 -0.1250000 0.8906250 17.9 4.101562 319
library(lubridate)
as_datetime(t$data[1,1], tz = "Europe/London")
# [1] "2013-07-13 10:00:05 BST"
But the start time of the g.shell.GGIR function output is 2013-07-13T10:15:00+0100.
“output_accsamp/meta/csv/accsamp.cwa.RData.csv” file:

The parameters are set as follows.
dir <- "D:/accsamp.cwa" #cwa file
o.dir <- "D:/" #output path
name <- "accsamp"
GGIR <- function(d.dir, o.dir, name){
mode= c(1,2,3,4,5) # g.part1:5
datadir= d.dir
outputdir= o.dir
studyname= name
f0 = 1 # number of file to start with
f1 = 1 # number of file to end with
desiredtz = "Europe/London" # time zone
g.shell.GGIR(#-------------------------------
# General parameters
#-------------------------------
mode=mode,
datadir=datadir,
outputdir=outputdir,
studyname=studyname,
f0=f0,
f1=f1,
overwrite = FALSE,
do.imp=TRUE,
idloc=1,
print.filename=FALSE,
storefolderstructure = FALSE,
desiredtz=desiredtz,
#start = 0,
#dayborder = 10,
#-------------------------------
# Part 1 parameters:
#-------------------------------
windowsizes = c(5,900,3600),
desiredtz=desiredtz,
do.cal=TRUE,
do.enmo=TRUE,
do.anglez=TRUE,
chunksize=1.5,
printsummary=TRUE,
do.hfen = FALSE,
#-------------------------------
# Part 2 parameters:
#-------------------------------
strategy = 1,
#ndayswindow = nday,
hrs.del.start = 0,
hrs.del.end = 0,
maxdur = 0,
includedaycrit = 2,
M5L5res = 10,
winhr = c(5,10),
qlevels = c(0.25,0.5,0.75),
qwindow=c(0,24),
ilevels = c(0,100,200),
mvpathreshold =c(100,120),
epochvalues2csv=TRUE,
L5M5window = c(0,24),
#-------------------------------
# Part 3 parameters:
#-------------------------------
timethreshold= c(5),
anglethreshold=5,
ignorenonwear = TRUE,
#-------------------------------
# Part 4 parameters:
#-------------------------------
excludefirstlast = FALSE,
includenightcrit = 2,
def.noc.sleep = c(1),
outliers.only = FALSE,
criterror= 0,
relyonsleeplog = FALSE,
sleeplogidnum = FALSE,
do.visual = TRUE,
nnights = c(),
excludefirstlast = FALSE,
#-------------------------------
# Part 5 parameters:
#-------------------------------
# Key functions: Merging physical activity with sleep analyses
excludefirstlast.part5 =FALSE,
threshold.lig = c(30),
threshold.mod = c(100),
threshold.vig = c(500),
boutcriter = 0.8,
boutcriter.in = 0.9,
boutcriter.lig = 0.8,
boutcriter.mvpa = 0.8,
boutdur.in = c(1,10,30),
boutdur.lig = c(1,5,10),
boutdur.mvpa = c(1,5,10),
timewindow = c("WW"),
#save_ms5rawlevels=FALSE
#includedaycrit.part5 = 0.1,
#-----------------------------------
# Report generation
#-------------------------------
do.report=c(2,4,5),
visualreport=TRUE,
dofirstpage = FALSE,
viewingwindow=1)
}
GGIR(dir, o.dir, name)
Thanks for all your help!
Best,
Chian-Heng
--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/9443cef6-94cc-4bb4-a76f-2944cbc1703an%40googlegroups.com.