find_walking: Finds walking and calculate steps from raw acceleration data.

View source: R/find_walking.R

find_walkingR Documentation

Finds walking and calculate steps from raw acceleration data.

Description

Method finds periods of repetitive and continuous oscillations with predominant frequency occurring within know step frequency range. Frequency components are extracted with Continuous Wavelet Transform.

Usage

find_walking(
  data,
  sample_rate_analysis = 10L,
  min_amplitude = 0.3,
  step_frequency = c(1.4, 2.3),
  alpha = 0.6,
  beta = 2.5,
  min_duration_peak = 3L,
  delta = 20L,
  verbose = TRUE,
  disable_parallelization = TRUE
)

Arguments

data

A data.frame with a column for time in POSIXct (usually HEADER_TIMESTAMP), and X, Y, Z

sample_rate_analysis

sampling frequency (in Hz) for analyzing walking. Note, this is NOT the sampling frequency of the data.

min_amplitude

minimum amplitude (in g)

step_frequency

step frequency range

alpha

maximum ratio between dominant peak below and within step frequency range

beta

maximum ratio between dominant peak above and within step frequency range

min_duration_peak

minimum duration of peaks (in seconds)

delta

maximum difference between consecutive peaks (in multiplication of 0.05Hz)

verbose

print diagnostic messages

disable_parallelization

Whether to disable the CPU parallelization used by oak through ssqueezepy. Parallelization can speed up larger analyses but may conflict with an R/Python environment or its threading and OpenMP configuration. The default, TRUE, sets SSQ_PARALLEL=0 while this function runs. If forest fails to load, set Sys.setenv(SSQ_PARALLEL = 0) before calling py_require_forest() and reticulate::import("forest"). See https://github.com/OverLordGoldDragon/ssqueezepy#gpu–cpu-acceleration.

Value

A vector of number of steps per second

Examples


  Sys.setenv("SSQ_PARALLEL" = 0)
  csv_file = system.file("test_data_bout.csv", package = "walking")
  if (requireNamespace("readr", quietly = TRUE) && reticulate::py_module_available("forest")) {
    x = readr::read_csv(csv_file)
    colnames(x)[colnames(x) == "UTC time"] = "time"
    res = find_walking(data = x)
  }


walking documentation built on Aug. 25, 2026, 5:06 p.m.