Calculate Step and Cadence Metrics from Wearable Data
Overview
Provides functions to calculate step- and cadence-based metrics from timestamped accelerometer and wearable device data. Supports CSV and AGD files from 'ActiGraph' devices, CSV files from 'Fitbit' devices, and step counts derived with R package 'GGIR' https://github.com/wadpac/GGIR, with automatic handling of epoch lengths from 1 to 60 seconds. Metrics include total steps, cadence peaks, minutes and steps in predefined cadence bands, and time and steps in moderate-to-vigorous physical activity (MVPA). Methods and thresholds are informed by the literature, e.g., Tudor-Locke and Rowe (2012) doi:10.2165/11599170-000000000-00000, Barreira et al. (2012) doi:10.1249/MSS.0b013e318254f2a3, and Tudor-Locke et al. (2018) doi:10.1136/bjsports-2017-097628. The package record is also available on Zenodo (2023) doi:10.5281/zenodo.7858094.
- Tests: hardened timestamp checks to be robust across platforms (Windows, macOS ARM, Linux). Added cross-platform ISO-8601 parser that correctly handles
Zandhh:mmoffsets. - CI: added macOS ARM (Apple Silicon) checks via R-hub v2 to reproduce CRAN’s environment.
From NEWS.md in the release
Install
Health
ERRORtestsr-devel-windows-x86_64, r-release-windows-x86_64
r-devel-windows-x86_64
Running 'spelling.R' [0s]
Running 'testthat.R' [11s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(stepmetrics)
>
> test_check("stepmetrics")
Saving _problems/test-readFile-103.R
________________________________________________________________________________
Calculating features per day...
Processing participant: S001
________________________________________________________________________________
Calculating means per recording
Processing participant: S001
________________________________________________________________________________
Storing output...
...[truncated]...
________________________________________________________________________________
Calculating features per day...
Processing participant: 101
________________________________________________________________________________
Calculating means per recording
Processing participant: 101
________________________________________________________________________________
Storing output...
Analyses complete!
Your output is stored here: D:\temp\2026_10_25_01_50_00_21025\Rtmp4cqwv7\stepmetrics_out_17a343082244
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 67 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test-readFile.R:103:3'): reads and formats data correctly ─────────
Expected `unclass(as.POSIXct(ts, tz = "UTC"))` to be identical to `unclass(exp)`.
Differences:
`actual`: 1625312880.0
`expected`: 1625320080.0
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 67 ]
Error:
! Test failures.
Execution haltedr-release-windows-x86_64
Running 'spelling.R' [0s]
Running 'testthat.R' [12s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
> # This file is part of the standard setup for testthat.
> # It is recommended that you do not modify it.
> #
> # Where should you do additional test configuration?
> # Learn more about the roles of various files in:
> # * https://r-pkgs.org/tests.html
> # * https://testthat.r-lib.org/reference/test_package.html#special-files
>
> library(testthat)
> library(stepmetrics)
>
> test_check("stepmetrics")
Saving _problems/test-readFile-103.R
________________________________________________________________________________
Calculating features per day...
Processing participant: S001
________________________________________________________________________________
Calculating means per recording
Processing participant: S001
________________________________________________________________________________
Storing output...
...[truncated]...
________________________________________________________________________________
Calculating features per day...
Processing participant: 101
________________________________________________________________________________
Calculating means per recording
Processing participant: 101
________________________________________________________________________________
Storing output...
Analyses complete!
Your output is stored here: D:\temp\2026_10_21_01_50_00_6553\RtmpAr9ieY\stepmetrics_out_2222c7c65374
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 67 ]
══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test-readFile.R:103:3'): reads and formats data correctly ─────────
Expected `unclass(as.POSIXct(ts, tz = "UTC"))` to be identical to `unclass(exp)`.
Differences:
`actual`: 1625312880.0
`expected`: 1625320080.0
[ FAIL 1 | WARN 0 | SKIP 0 | PASS 67 ]
Error:
! Test failures.
Execution halted- ERROR11 OK, 2 ERRORNow
- ERROR13 OK, 1 ERROR2026-03-10
Documentation
- Help pages
- 6
- Examples that run
- 50%3 run in a plain check · 2 only when donttest examples are enabled (R CMD check --as-cran) · 1 never run
- Exported functions with examples
- 100%
- Documented parameters
- 93%
- Return-value docs
- 100%
- Help pages citing references
- 0%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 2
- Median days to close, 50 most recently updated closed PRs
- 0
3 development-tooling and community-health practices detected across 2 families in the upstream repository
Checks run against github.com/jhmigueles/stepmetrics on 2026-10-25.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
This repository shows signs of AI coding tools.
- Codexfirst seen 2025-06-20Pull request it wrote: opened by a project member
Dependencies
Installing stepmetrics adds 1 package (0 with compiled code, 2.3 MB of source tarballs). Heaviest: PhysicalActivity 2.3 MB.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- RR 4.6.0 released · 2026-04-24
- 1.0.3Latest
- 1.0.12025-09-16
- RR 4.5.0 released · 2025-04-11
Package metadata
- First published
- 2025-09-16
- Total releases
- 2 / 1 yrs
- License
- AGPL (>= 3) OSI
- Minimum R
- ≥ 3.5.0
- Download size
- 1.7 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("stepmetrics")The package provides a citation file that builds its entry when R runs it. Run citation() to see it.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-26, which the citation names so these numbers can be found later. More on citing and the projects behind them.