preprocess_bout: Preprocesses accelerometer bout to a common format.

View source: R/preprocess_bout.R

preprocess_boutR Documentation

Preprocesses accelerometer bout to a common format.

Description

Resample 3-axial input signal to a predefined sampling rate and compute vector magnitude.

Usage

preprocess_bout(data, sample_rate = 10L)

preprocess_bout_r(data, sample_rate = 10L)

Arguments

data

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

sample_rate

sampling frequency, coercible to an integer. This is the sampling rate you're sampling the data into.

Value

A list of vm_bout, which is an unnamed list of length 2, containing times and VM (vector magnitude) interpolated. This will be passed into other forest functions. The list also contains vm_data, which transforms vm_bout into a data.frame after creating the required times.

Examples


  csv_file = system.file("test_data_bout.csv", package = "walking")
  if (requireNamespace("readr", quietly = TRUE)) {
    x = readr::read_csv(csv_file)
    colnames(x)[colnames(x) == "UTC time"] = "time"
    if (reticulate::py_module_available("forest")) {
      res = preprocess_bout(data = x)
      res2 = preprocess_bout_r(data = x)
      testthat::expect_equal(res$vm_bout, res2$vm_bout, tolerance = 1e-4)
    }
  }


walking documentation built on Aug. 4, 2026, 1:07 a.m.