getGENEAsegments: import and segment one or more bin files.

View source: R/getGENEAsegments.R

getGENEAsegmentsR Documentation

import and segment one or more bin files.

Description

Import and summarize GENEActiv bin data for manual classification.

Usage

getGENEAsegments(
  testfile,
  start = NULL,
  end = NULL,
  Use.Timestamps = FALSE,
  radians = FALSE,
  keep_raw_data = TRUE,
  mmap.load = (.Machine$sizeof.pointer >= 8),
  outputtoken = "_segmented",
  outputdir = "GENEAclassification",
  datacols = "default",
  decimalplaces = "default",
  filterWave = FALSE,
  filtername = "haar",
  j = 8,
  changepoint = c("UpDownDegrees", "TempFreq", "UpDownFreq", "UpDownMean", "UpDownVar",
    "UpDownMeanVar", "DegreesMean", "DegreesVar", "DegreesMeanVar",
    "UpDownMeanVarDegreesMeanVar", "UpDownMeanVarMagMeanVar"),
  penalty = "Manual",
  pen.value1 = 40,
  pen.value2 = 400,
  intervalseconds = 30,
  mininterval = 5,
  samplefreq = 100,
  filterorder = 2,
  boundaries = c(0.5, 5),
  Rp = 3,
  plot.it = FALSE,
  hysteresis = 0.1,
  stft_win = 10,
  plot_changepoints = FALSE,
  plot_changepoints_outputfile = "Changepoint",
  verbose = FALSE,
  ...
)

Arguments

testfile

character vector stating path to a GENEActiv bin file, or a folder containing GENEActiv bin files.

start

Where to start reading observations.

end

Where to end reading observations.

Use.Timestamps

To use timestamps as the start and end time values this has to be set to TRUE. (Default FALSE)

radians

calculate degrees rotation in radians.

keep_raw_data

Keep the raw data for calculating steps using stepcounter.

mmap.load

Default is (.Machine$sizeof.pointer >= 8). see mmap for more details

outputtoken

single character string to be appended to the file name for saving the segmenation output (default '_segmentated').

outputdir

The absolute or relative path to directory in which artifacts (plot and changes files) should be created, or NULL (default "GENEAclassification").

datacols

a vector constructed 'column.summary' or 'default'. See segmentation for details.

decimalplaces

named numeric vector of decimal places with which to round summary columns. NULL returns unrounded values. The length 1 character vector 'default' applies default roundings:

  • Start.Time = 0,

  • Degrees.mean = 3,

  • Degrees.median = 3,

  • Degrees.var = 3,

  • Degrees.sd = 3,

  • Degrees.mad = 3,

  • Magnitude.mean = 3,

  • UpDown.mean = 3,

  • UpDown.median = 3,

  • UpDown.var = 3

  • UpDown.sd = 3,

  • UpDown.mad = 3,

  • Principal.Frequency.median = 3,

  • Principal.Frequency.mad = 3,

  • Principal.Frequency.ratio = 3,

  • Principal.Frequency.sumdiff = 3,

  • Principal.Frequency.meandiff = 3,

  • Principal.Frequency.abssumdiff = 3,

  • Principal.Frequency.sddiff = 3,

  • Light.mean = 0,

  • Light.max = 0,

  • Temp.mean = 1,

  • Temp.sumdiff = 3

  • Temp.meandiff = 3

  • Temp.abssumdiff = 3

  • Temp.sddiff = 3

  • Step.count = 0

  • Step.sd = 1

  • Step.mean = 0

  • Step.GENEAamplitude = 3

  • Step.GENEAwavelength = 3

  • Step.GENEAdistance = 3

This can be changed by using a named list. e.g decimalplaces = c(Start.Time = 2, Degrees.mean = 4).

filterWave

single logical, should a smoothing filter from wave.filter be applied? (default FALSE).

filtername

single character, the name of the wavelet to use for smoothing when filter is TRUE. (default "haar") Passed to link[waveslim]{wave.filter}.

j

single numeric, the level to which to smooth. Passed to link[waveslim]{wave.filter} (default 8).

changepoint

defines the change point analysis to use. UpDownDegrees performs the change point analysis on the variance of arm elevation and wrist rotation. TempFreq performs a change point on the variance in the temperature and frequency (Typically better for sleep behaviours).

penalty

single character, the penalty to use for changepoint detection. default ("SIC").

pen.value1

Value of the type 1 error required when penalty is "Asymptotic".

pen.value2

Default set as NULL and so equals pen.value1 if no input.

intervalseconds

An integer number of seconds between 5 and 30 during which at most one changepoint may occur.

mininterval

single numeric that defines the smallest changepoint initially found. Passed to cpt.var as the variable minseglen

samplefreq

The sampling frequency of the data, in hertz, when calculating the step number. (default 100).

filterorder

The order of the filter applied with respect to the butter or cheby options. See cheby1 or butter.

boundaries

to pass to the filter in the step counting algorithm.

Rp

the decibel level that the cheby filter takes. See cheby1.

plot.it

single logical, Creates a plot showing the zero crossings counted by the step counting algorithm#' @param Centre Centres the xz signal about 0 when set to True.

hysteresis

The hysteresis applied after zero crossing. (default 100mg)

stft_win

numeric for the window to calculate the frequency of an event using the stft function.

plot_changepoints

single logical, Creates a plot displaying the changepoint locations.

plot_changepoints_outputfile

The name of the png file created that shows the change points on a positionals plots.

verbose

single logical should additional progress reporting be printed at the console? (default TRUE).

...

other arguments to be passed to dataImport, segmentation and other functions with these functions.

Value

segmented data are returned

See Also

The returned object can be interrogated with head.

Examples

## testfile = file.path(system.file(package = "GENEAread"),
##                                  "binfile",
##                                  "TESTfile.bin")
## 
## segData <- getGENEAsegments(testfile = testfile,
##                             outputdir = file.path(tempdir(), "GENEAclassification"),    
##                             changepoint = "UpDownDegrees",
##                             pen.value1 = 1,
##                             pen.value2 = 1)
## head(segData)
## list.files(file.path(tempdir(), "GENEAclassification"))

GENEAclassify documentation built on March 31, 2023, 9:01 p.m.