Function to merge the output from g.part2 and g.part4 into one report enhanced with profiling of sleep and physical activity stratified across intensity levels and based on bouted periods as well as non-bouted periods.
g.part5(datadir=c(), metadatadir=c(), f0=c(), f1=c(), strategy=1,
maxdur=7, hrs.del.start=0, hrs.del.end =0,
loglocation= c(), excludefirstlast.part5=FALSE,
windowsizes=c(5,900,3600),acc.metric="ENMO", boutcriter.mvpa=0.8,
boutcriter.in=0.9, boutcriter.lig=0.8, storefolderstructure=FALSE,
threshold.lig = c(40), threshold.mod = c(100),
threshold.vig = c(400), timewindow=c("MM","WW"),
boutdur.mvpa = c(1,5,10), boutdur.in = c(10,20,30),
boutdur.lig = c(1,5,10), winhr = 5, M5L5res = 10,
overwrite=FALSE, desiredtz="",
bout.metric=4, dayborder=0, save_ms5rawlevels=FALSE, do.parallel=TRUE,
part5_agg2_60seconds = FALSE, save_ms5raw_format="csv",
save_ms5raw_without_invalid=TRUE,
data_cleaning_file=c(), includedaycrit.part5=2/3,
frag.metrics=c(), iglevels=c(), maxNcores=c(),
LUXthresholds = c(0, 500, 1000, 5000, 10000, 20000),
LUX_cal_constant = c(), LUX_cal_exponent = c(),
LUX_day_segments = c())
Directory where the accelerometer files are stored or list of accelerometer filenames and directories
Directory that holds a folders 'meta' and inside this a folder 'basic' which contains the milestone data produced by g.part1. The folderstructure is normally created by g.part1 and g.shell.GGIR will recognise what the value of metadatadir is.
File index to start with (default = 1). Index refers to the filenames sorted in increasing order
File index to finish with (defaults to number of files available)
how to deal with knowledge about study protocol. value = 1 means select data
based on hrs.del.start
, hrs.del.end
, and maxdur
.
Value = 2 makes that only the data between the first midnight and the last
midnight is used for imputation, see g.impute
how many DAYS after start of experiment did experiment definitely stop? (set to zero if unknown = default), see g.impute
how many HOURS after start of experiment did wearing of monitor start?, see g.impute
how many HOURS before the end of the experiment did wearing of monitor definitely end?, see g.impute
Location of the spreadsheet (csv) with sleep log information. The spreadsheet needs to have the following structure: one column for participant id, and then followed by alternatingly one column for onset time and one column for waking time. Timestamps are to be stored without date as in 18:20:00. If onset corresponds to lights out or intention to fall asleep, then it is the end-users responsibility to account for this in the interpretation of the results.
If TRUE then the first and last night of the measurement are ignored for the leep assessment.
see g.getmeta
Which one of the metrics do you want to consider to describe behaviour. The metric of interest need to be calculated in M (see g.part1)
A number between 0 and 1 and defines what fraction of a bout needs to be above the mvpathreshold
A number between 0 and 1 and defines what fraction of a bout needs to be below the light threshold
A number between 0 and 1 and defines what fraction of a bout needs to be between the light and moderage threshold
Store folder structure of the accelerometer data
Threshold for light physical activity to separate inactivity from light. Value can be one number or an array of multiple numbers, e.g. threshold.lig =c(30,40). If multiple numbers are entered then analysis will be repliced for each combination of threshold values. Threshold is applied to the first metric in the milestone data, so if you have only specified do.ENMO == TRUE then it will be applied to ENMO.
Threshold for moderate physical activity to separate light from moderate. Value can be one number or an array of multiple numbers, e.g. threshold.mod =c(100,110). If multiple numbers are entered then analysis will be repliced for each ombination of threshold values. Threshold is applied to the first metric in the milestone data, so if you have only specified do.ENMO == TRUE then it will be applied to ENMO.
Threshold for vigorous physical activity to separate moderate from vigorous. Value can be one number or an array of multiple numbers, e.g. threshold.mod =c(400,500). If multiple numbers are entered then analysis will be repliced for each combination of threshold values. Threshold is applied to the first metric in the milestone data, so if you have only specified do.ENMO == TRUE then it will be applied to ENMO.
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").
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.
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.
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.
resoltion of L5 and M5 analysis in minutes (default: 10 minutes)
Overwrite previously generated milestone data by this function for this particular dataset. If FALSE then it will skip the previously processed files (default = FALSE).
see g.getmeta
See documnetion in g.getbout and
Hour at which days start and end (default = 0), value = 4 would mean 4am
see g.getmeta
Boolean, whether to save the time series classification (levels) as a csv files
Boolean whether to use multi-core processing (only works if at least 4 CPU cores are available.
Boolean whether to use aggregate epochs to 60 seconds as part of the part 5 analysis.
Character string to specify how data should be stored: either "csv" (default) or "RData". Only used if save_ms5rawlevels is set to TRUE.
Boolean to indicate whether to remove invalid days from the time series output files. Only used if save_ms5rawlevels is set to TRUE.
See g.part4. Note that in part 5 this affects both the time series and the csv reports.
See g.report.part5. Only used in this function if save_ms5rawlevels is TRUE, and it only affects the time series files stored.
Fragmentation metric(s) to use. See g.fragmentation
See g.analyse. If provided then the intensity gradient will be calculated
Vector with numeric sequece corresponding to the thresholds used to calculated time spent in LUX ranges.
See function g.part1
Numeric, if both LUX_cal_constant and LUX_cal_exponent are provided LUX LUX values are converted based on formula y = constant * exp(x * exponent)
Numeric, if both LUX_cal_constant and LUX_cal_exponent are provided LUX LUX values are converted based on formula y = constant * exp(x * exponent)
Numeric vector with hours at which the day should be segmented for the LUX analysis.
The function does not produce values but generates an RData file
in the milestone subfolder ms5.out which incudes a dataframe
named output
. This dataframe is used in g.report.part5 to create
two reports one per day and one per person. See package vignette
paragraph "Output part 5" for description of all the variables.
# NOT RUN {
metadatadir = "C:/myfolder/meta"
g.part5(metadatadir=metadatadir)
# }
Run the code above in your browser using DataLab