This is the primary wrapper function for sleepIPD. In most cases, this should be the only function that is needed. reprocess collects data about your study, and then calls the functions to reprocess the data, collate the results, and generate the metadata.

reprocess(
  datadir,
  outputdir,
  studyname,
  ages = c("children", "adults"),
  device = c("geneactiv", "actigraph"),
  wear_location = "wrist",
  overwrite = FALSE,
  verbose = TRUE,
  ...
)

Arguments

datadir

The directory with the files to process or a vector of file paths to process (as per GGIR::g.shell.GGIR()).

outputdir

the directory to store the output (as per GGIR::g.shell.GGIR()).

studyname

The name of the study. This is required to name the metadata.

ages

The age of the sample. Can be either "children" (for those 18 or less), "adults" (for >18) or both (i.e., c("children", "adults")). If you do not specify, both are used.

device

The device used in the study. Can be either "geneactiv", "actigraph" or (in the unlikely event two devices were used) both (i.e., c("geneactiv", "actigraph")). If you do not specify, both are used.

wear_location

The location the device was warn. Can be either "wrist" (the default) or "hip" If the study has mixed wear locations, you need to run the function twice, once for each location.

overwrite

If the existing output (including metadata) should be replaced. FALSE by default.

verbose

Determines how much output the function returns. Useful for understanding what the package is doing. TRUE by default.

...

Pass additional parameters to GGIR::g.shell.GGIR(). Refer to the GGIR manual for details.

Details

The purpose of sleepIPD is to standardise the processing of the accelerometery files. As such, most of the arguments come preset and should not be modified. However, options which do not affect the output (e.g., the decision to process in parallel or not) are available via .... See GGIR::g.shell.GGIR() for details of these arguments.

You can specify parameters of your study by supplying ages, device, and/or wear_location (see Arguments for details). Not supplying these will cause sleepIPD to calculate every combination of thresholds (resulting in \(8^3 \times 2 = 1024\) output files). So, supplying them should slightly reduce processing time.

You should also supply a studyname argument. This is required by GGIR if your datadir is a vector of files, but is additionally used by sleepIPD to name the output files. If your study did not have a name, the last name of the first author is sufficent (if you are supplying multiple studies, name each one with the year the data were collected; e.g., studyname = 'Hartwig 2021').

See also

Other processing functions: process_files()

Examples

if (FALSE) {
datadir <- "C:\\Documents\\My Study\\Data"
outputdir <- "C:\\Documents\\My Study\\Output"
studyname <- "Hartwig 2021"
ages <- "children"
device <- "geneactiv"
wear_location <- "wrist"

reprocess(
  datadir = datadir,
  outputdir = outputdir,
  studyname = studyname,
  ages = ages,
  device = device,
  wear_location = wear_location
)
}