stepmetrics

CRAN status R-CMD-check_standard Codecov test coverage DOI CRAN downloads CRAN downloads total

Overview

The stepmetrics package provides tools to calculate step- and cadence-based metrics from wearable device data. It supports data aggregated at epochs of 1–60 seconds, and automatically re-aggregates sub-minute data to 60-second epochs before computing metrics.

Currently, the package has been tested with data from:

Main functionalities

Installation

The stable release of stepmetrics can be installed from CRAN:

# install.packages("devtools")
install.packages("stepmetrics")

You can install the development version of stepmetrics from GitHub with:

# install.packages("devtools")
devtools::install_github("jhmigueles/stepmetrics")

Core Workflow

The main function is step.metrics(), which processes raw step data and exports day-level and person-level summaries.

library(stepmetrics)
step.metrics(datadir = "C:/mydata/",
             outputdir = "C:/myoutput/",
             idloc = "_",
             cadence_bands = c(0, 1, 20, 40, 60, 80, 100, 120, Inf),
             cadence_peaks = c(1, 30, 60),
             cadence_MOD = 100,
             cadence_VIG = 130,
             includedaycrit = 10,
             exclude_pk30_0 = TRUE,
             exclude_pk60_0 = TRUE,
             time_format = NULL)

This function does not return an object into the R session. Instead, it generates:

Working with GGIR output

If your step counts were generated in GGIR (e.g., with an external algorithm such as Verisense):

Important: stepmetrics looks for a column with "step" in its name. Valid examples:

When computing steps externally for GGIR, ensure your chosen column name follows this convention.

Key Functions

Example Outputs

Day-level output (*_DaySum.csv) includes:

Person-level output (personSummary.csv) includes:

Citation

If you use stepmetrics in your research, please cite:

Migueles, JH. stepmetrics: Calculate Step and Cadence Metrics from Wearable Data. Zenodo. DOI: 10.5281/zenodo.7858094