Skip to contents

Use the stepcount package to estimate steps from raw accelerometer data and summarize them to minute-level epochs (as opposed to 10s default)

Usage

acti_calculate_stepcount(data, sample_rate = NULL, ..., epoch = "1 minute")

Arguments

data

A data.frame, AccData object, or GT3X file with X, Y, Z, and time

sample_rate

Sample rate in Hz. If omitted, it is taken from the input object when available.

...

Additional arguments passed to stepcount::stepcount()

epoch

epoch unit to aggregate the data to, passed to lubridate::floor_date(), original output is at 10-seconds

Value

A tibble with minute-level time, steps, and walking columns.

Examples

# \donttest{
  # reticulate::py_require("stepcount==3.11.0", python_version = "3.10", action = "add")
  # sc = try({ reticulate::import("stepcount") })
  if (stepcount::have_stepcount()) {
    data = actiread::acti_read_gt3x(actiread::acti_example_gt3x())
    steps = acti_calculate_stepcount(data, sample_rate = 100)
    steps = acti_calculate_stepcount(data, model_type = "rf")
  }
#> Warning: Python version requirements cannot be changed after Python has been initialized.
#> * Python version request: '3.10' (from package:stepcount)
#> * Python version initialized: '3.12.14'
# }