reintegrate: Reintegrate ActiGraph data

View source: R/Reintegrate.R

reintegrateR Documentation

Reintegrate ActiGraph data

Description

Reintegrate ActiGraph data

Usage

reintegrate(
  ag,
  target_sec,
  time_var = "Timestamp",
  method = c("tidy", "legacy"),
  ...
)

reintegrate_legacy(
  ag,
  target_sec,
  time_var = "Timestamp",
  direction = c("forwards", "backwards"),
  verbose = FALSE
)

Arguments

ag

a data frame to reintegrate

target_sec

the desired epoch length of the output. Starting epoch length will be determined automatically

time_var

The name of the column containing POSIX-formatted timestamp information

method

character scalar indicating the desired method of reintegration. Options are tidy (the default) and legacy. See details

...

arguments passed to reintegrate_legacy

direction

The direction of reintegration, i.e. whether a timestamp refers to the timespan after the previous data point ("backwards"), or before the next data point ("forwards").

verbose

logical. Print updates to console?

Details

Two methods are provided. One is a legacy method that allows "forward" or "backward" reintegration, depending on whether the timestamp occurs (respectively) at the start of the interval (typical for activity monitors) or the end (typical for indirect calorimeters). The other is a tidy approach, which is both more straightforward and more concise. However, runtime implications are uncertain, and only forward reintegration is supported (consistent with 'ActiLife' precedent).

Value

A data frame of reintegrated activity count data

Examples


test_file <- system.file(
  "extdata", "example1sec.csv", package = "AGread"
)

ag <- read_AG_counts(test_file, header = TRUE)

# Old Method:

  old_result <- reintegrate(
    ag = ag,
    target_sec = 60,
    time_var = "Timestamp",
    method = "legacy",
    direction = c("forwards")
  )

# New Method:

  new_result <- reintegrate(ag, 60)


AGread documentation built on Sept. 13, 2022, 5:06 p.m.