Hello
I am new to GGIR so sorry if this is obvious :)
Background: I am looking at delirium in hospitalised patients with parkinsons disease to explore whether wearable sensors could aid in identification of delirium. They wore a wrist sensor during their admission. I am hoping to show sleep disruption, fragmentation and day night reversal which is a suggested feature.
I haven't used a sleep diary as pts are generally too agitated, however 'lights' on the ward are out at 10pm and wake is generally 7am. (Not exact but the best i can go with). I am wanting to set the guider however I am receiving the following error. please see below and also the code I am using. Also wondering if it is possible for only the guider I set to be used? sorry again if this is completely obvious, i am just getting to grips with it.
Many thanks
Gemma
ibrary(GGIR)
g.shell.GGIR(#=======================================
# INPUT NEEDED:
mode=c(1,2,3,4,5),
overwrite = TRUE,
#datadir= args[1],
#outputdir= args[2],
idloc=2, #id location (1 = file header, 2 = filename)Rcpp::
datadir = rawdatadir,
outputdir = outputpath,
#f0=1, f1=2,
#-------------------------------
# Part 1:
#-------------------------------
# Key functions: reading file, auto-calibration, and eastracting features
do.enmo = TRUE, do.anglez=TRUE,
chunksize=1, # number between 0.2 and 1 to specificy the size of chunks to be loaded as a fraction of a 24 hour period,
# e.g. 0.5 equals 12 hour chunks. The default is 1(24 hrs). influence the
printsummary=TRUE,
#-------------------------------
# Part 2:
#-------------------------------
# Key functions: Non-wear detection, imputation, and basic descriptives
strategy = 2, #only relevant when strategy = 3
ndayswindow=7, # only relevant when strategy = 3, then this is the size of the window as a number of days
hrs.del.start = 0, # Only relevant when strategy = 2. How many HOURS need to be ignored at the START of the measurement?
hrs.del.end = 0, # Only relevant when strateg
y = 2, #How many HOURS need to be ignored at the END of the measurement?
maxdur = 8, # How many DAYS of measurement do you maximumally expect?
includedaycrit = 8, # number of minimum valid hours in a day to attempt physical activity analysis
winhr = 5, # size of M5 and L5 (5 hours by default) if two values c(5,10)
# given then the code will calculate each value seperately
qlevels = c(c(1380/1440),c(1410/1440)), # array of percentiles for which value needs to be extracted.
qwindow=c(0,24),
# To specify windows over which all variables are calculated. If value = c(0,24) all variables will only be calculated over the full 24 hours
# in a day, If value =c(8,24) variables will be calculated over the window 0-8, 8-24 and 0-24. Previously this functionality was limited to the
# distribution in acceleration metric values, but now it also derives N valid hours, L5M5 analysis and MVPA.
ilevels = c(seq(0,400,by=50),8000), #acceleration values (metric ENMO) from which a frequency distribution needs to be derived
# set value at c() if you do not want quantiles。 This will generate few columns in analysis results: [A,B)_ENMO_mg_0-24h
# Time spent in minutes between (and including) acceleration value A in mg and (excluding) acceleration value B in mg.
# This is only done for metric ENMO at the moment, and only done if ilevels is not left blank
mvpathreshold =c(100,120), #Threshold for MVPA estimation. Threshold needs to be based on metric ENMO. This can be a single number or an array
# of numbers, e.g. c(100,120). In the later case the code will estimate MVPA seperately for each threshold. If this variable is left blank c()
# then MVPA is not estimated
bout.metric = 4,
# option 4: using sliding window across the data to test bout criteria per window and do not allow for breaks of 1 minute or longer.
# it requires the first and last epoch to require the threshold criteria.
closedbout=FALSE, #TRUE if you want breaks in bouts to be counted towards time spent in bouts (argument only active for bout.metric 1 and 2)
# M5L5res = 10, #resolution in minutes of M5 and L5 calculation say 14.5 = 14:30, 14.33 = 14:20
# winhr = c(5,10), # size of M5 and L5 (5 hours by default) Starting hour of M5 and L5 on a scale from 0 to 24
# Vector of window size(s) (unit: hours) of L5 and M5 analysis (dedault = 5 hours)
# Starting time in hours of the most active five* hours in the day within the time interval as specified (* window size defined by argument winhr)
# Starting time in hours of the least active five* hours within the time interval as specified (* window size defined by argument winhr)
#-------------------------------
# Part 3:
#-------------------------------
# Key functions: Sleep detection
timethreshold= c(5,10), # Time threshold (minutes) for sustained inactivity periods detection, default = 5.
# This can be specified as multiple thresholds, each of which will be implemented. For example, timethreshold = c(5,10)
anglethreshold=5,
ignorenonwear = TRUE, # If TRUE then ignore detected monitor non-wear periods to avoid confusion between
# monitor non-wear time and sustained inactivity (default = TRUE)
#-------------------------------
# Part 4:
#-------------------------------
# Key functions: Integrating sleep log (if available) with sleep detection
# storing day and person specific summaries of sleep
excludefirstlast = FALSE, # If TRUE then the first and last night of the measurement are ignored for the sleep assessment.
includenightcrit = 16, # Minimum number of valid hours per night (24 hour window between noon and noon)
#def.noc.sleep = c(1), # e.g. def.noc.sleep=c(1) then the window will be detected with the method as
def.noc.sleep = c(22, 7), # described in van Hees et al. 2018 Scientific Reports.
relyonsleeplog=FALSE,
outliers.only = TRUE,
criterror = 4,
sleeplogidnum = FALSE,
colid=1,
coln1=2,
do.visual = TRUE,
nnights = 7,
#-------------------------------
# Part 5:
# Key functions: Merging physical activity with sleep analyses
#-------------------------------
excludefirstlast.part5 = FALSE,
threshold.lig = c(30,40), #threshold(s) for inactivity (can be more than one number) unit in milligravity(mg)
threshold.mod = c(100), #threshold(s) for moderate activity (can be more than one number) if we have two number then the code will estimate MVPA seperately
# for each threshold
threshold.vig = c(400), #threshold(s) for vigorous activity (can be more than one number)
boutcriter = 0.8, # The variable boutcriter is a number between 0 and 1 and defines what fractionof a bout needs to be above the mvpathreshold
boutcriter.in = 0.9, #fraction of an inactivity bout that needs to be below the threshold (needs to be 1 number)
boutcriter.lig = 0.8, #fraction of an light activity bout that needs to be between the thresholds (needs to be 1 number)
boutcriter.mvpa = 0.8, #fraction of an light activity bout that needs to be above the threshold (needs to be 1 number)
boutdur.in = c(1,10,30),# Durations of inactivty bouts in minutes to be extracted. Inactivity bouts are detected in the segments of the data
# which were not labelled as sleep or MVPA bouts. The default duration values is c(10,20,30), this will start with the identification of 30 minute
# bouts, followed by 20 minute bouts in the rest of the data, and followed by 10 minute bouts in the rest of the data.
boutdur.lig = c(1,10), # Durations of light activty bouts in minutes to be extracted. Light activity bouts are detected in the segments of
# the data which were not labelled as sleep, MVPA, or inactivity bouts. The default duration values is c(1,5,10), this will start with the
# identification of 10 minute bouts, followed by 5 minute bouts in the rest of the data, and followed by 1 minute bouts in the rest of the data.
boutdur.mvpa = c(1), # Durations of mvpa bouts in minutes to be extracted. The default values is c(1,5,10) and will start with the identification of 10 minute bouts, followed by 5
# minute bouts in the rest of the data, and followed by 1 minute bouts in the rest of the data.
timewindow = c("WW", "MM"), # Timewindow over which summary statistics are derived. Value can be "MM"
# (midnight to midnight), "WW" (waking time to waking time), or both c("MM","WW").
#-----------------------------------
# Report generation
#-------------------------------
# Key functions: Generating reports based on meta-data
do.report=c(2,3,4,5),
visualreport=TRUE,
dofirstpage = TRUE,
viewingwindow=1
)