mark_wear_time {activAnalyzer}R Documentation

Mark dataset for nonwear/wear time

Description

This function wraps the dataCollapser and the wearingMarking functions from the PhysicalActivity package. After collapsing data, the function adds time and date columns. Then, the function analyzes the dataset for nonwear time detection. Finally, the function adds two variables to the dataset: the variable non_wearing_count that contains the number 1 when the device was not worn (otherwise, 0 is used), and the variable wearing_count that contains the number 1 when the device was worn (otherwise, 0 is used).

Usage

mark_wear_time(
  dataset,
  TS = "TimeStamp",
  to_epoch = 60,
  cts = "vm",
  frame = 90,
  allowanceFrame = 2,
  streamFrame = 30
)

Arguments

dataset

A dataframe obtained using the prepare_dataset function.

TS

A character value indicating the name of the variable where date and time information are provided.

to_epoch

A numeric value indicating the length of the epoch to use (in seconds) for accumulating data. The value must be superior or equal to the recording epoch that was used for the measurement.

cts

A character value indicating the name of the variable used by the nonwear/wear detection algorithm.

frame

A numeric value for the length of the time window (in minutes) used to detect nonwear/wear time.

allowanceFrame

A numeric value for the length of the time window (in minutes) with nonzero counts allowed within the detected nonwear period.

streamFrame

A numeric value for the length of the time window required around the detected activity to validate nonwear time.

Value

A dataframe.

Examples

file <- system.file("extdata", "acc.agd", package = "activAnalyzer")
mydata <- prepare_dataset(data = file)
mydata_with_wear_marks <- mark_wear_time(
    dataset = mydata, 
    TS = "TimeStamp", 
    to_epoch = 60,
    cts  = "vm",
    frame = 90, 
    allowanceFrame = 2, 
    streamFrame = 30
    )
head(mydata_with_wear_marks)


[Package activAnalyzer version 2.1.1 Index]