โ›๏ธ axR

Device discovery, status, settings, and data download for accelerometer devices.

r-universe DOI License: MIT R R CMD CHECK Coverage Status pkgdown


๐Ÿ“– What is axR?

axR talks to Axivity AX3/AX6 accelerometers over USB: discovering connected devices, querying and setting status/configuration, and downloading recorded .cwa files. It also parses those .cwa files directly, and -- as of a recent addition -- Condor Instruments ActTrust .txt actigraphy exports, into the same tidy epoch shape.

Rather than reimplementing the Axivity serial protocol directly, axR wraps the Open Movement Project's OMAPI C library (vendored in src/omapi, BSD 2-clause, Newcastle University โ€” see src/omapi/LICENSE.TXT). OMAPI is the same library behind Axivity's own OmGui software, and includes maintained, platform-specific device discovery (IOKit/DiskArbitration on macOS, SetupAPI on Windows, udev on Linux) rather than a hand-rolled equivalent.

axR is deliberately mostly a "dumb pipe" โ€” it talks to the device and moves bytes, leaving higher-level actigraphy analysis to downstream packages such as mrpheus or zeitR. axivity_read_cwa() and read_acttrust() are deliberate exceptions: OMAPI already ships a complete .cwa reader, and ActTrust's .txt export format is a plain, well-specified text format -- so axR wraps/parses both directly rather than building a second, differently-sourced parser for either. read_acttrust() deliberately stops at device-format parsing, though: it returns the file's own epoch columns with no pipeline-specific columns or classes added, leaving that reshaping to downstream packages (e.g. zeitR), the same way axivity_read_cwa() does.


[!WARNING] axR has not been fully verified against real hardware. Live-device testing was performed on macOS and a real AX3. timestamp/x/y/z/device_id from axivity_read_cwa() have been verified correct against a real recording; temperature_c has not, and is likely wrong on at least some hardware revisions. Not tested against an AX6.


โœจ Features

There's no axivity_open()/close() step โ€” the OMAPI session starts when axR is loaded and stops when it's unloaded. Every device-facing function takes a device_id from axivity_discover().

๐Ÿ—‚๏ธ Project Structure

axR/
โ”œโ”€โ”€ configure              # generates src/Makevars at install time (chmod +x!)
โ”œโ”€โ”€ cleanup                # removes configure/build artefacts (chmod +x!)
โ”œโ”€โ”€ R/
โ”‚   โ”œโ”€โ”€ axR-package.R   # package-level documentation
โ”‚   โ”œโ”€โ”€ zzz.R            # .onLoad/.onUnload (OmStartup/OmShutdown), .om_check()
โ”‚   โ”œโ”€โ”€ discover.R        # axivity_discover(), axivity_enable_debug_log()
โ”‚   โ”œโ”€โ”€ status.R          # battery, self-test, memory health, accelerometer,
โ”‚   โ”‚                       # RTC, LED, lock, ECC, send_command
โ”‚   โ”œโ”€โ”€ settings.R        # delays, session ID, metadata, accel config, reset
โ”‚   โ”œโ”€โ”€ stage.R            # axivity_stage_device() -- one-call deployment staging
โ”‚   โ”œโ”€โ”€ download.R        # data info, download, download_status/wait/cancel,
โ”‚   โ”‚                       # axivity_copy_data()
โ”‚   โ”œโ”€โ”€ read_cwa.R        # axivity_read_cwa()
โ”‚   โ”œโ”€โ”€ read_acttrust.R   # read_acttrust()
โ”‚   โ””โ”€โ”€ utils.R           # internal message helpers (axr_abort/warn/inform), %||%
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ axR-omapi.cpp     # thin Rcpp wrapper around OMAPI
โ”‚   โ”œโ”€โ”€ omapi/             # vendored OMAPI C library (BSD 2-clause), with
โ”‚   โ”‚                       # axR patches -- see inline comments and NEWS.md
โ”‚   โ”œโ”€โ”€ Makevars.in       # template; configure fills in the platform-specific bits
โ”‚   โ””โ”€โ”€ Makevars.win      # Windows build config (static, no template needed)
โ”œโ”€โ”€ vignettes/
โ”‚   โ”œโ”€โ”€ axR.Rmd.orig      # real vignette source (not shipped)
โ”‚   โ””โ”€โ”€ axR.Rmd           # pre-computed output, knitr::knit()'d from .orig
โ”œโ”€โ”€ tests/testthat/
โ”œโ”€โ”€ man/figures/
โ”‚   โ”œโ”€โ”€ logo.svg
โ”‚   โ””โ”€โ”€ logo.png
โ”œโ”€โ”€ pkgdown/favicon/      # via pkgdown::build_favicons()
โ”œโ”€โ”€ .github/workflows/    # R-CMD-check.yaml, pkgdown.yaml
โ”œโ”€โ”€ _pkgdown.yml
โ”œโ”€โ”€ DESCRIPTION
โ””โ”€โ”€ NEWS.md

๐Ÿš€ Getting Started

Prerequisites

Installation

Install from r-universe (recommended โ€” pre-built binaries):

install.packages(
  "axR",
  repos = c("https://circadia-bio.r-universe.dev", "https://cloud.r-project.org")
)

Or install the development version from GitHub:

install.packages("pak")
pak::pak("circadia-bio/axR")

Linux only: r-universe's pre-built binaries don't bundle system libraries โ€” libudev-dev (or equivalent) still needs to be installed separately on the machine running R, regardless of install method.

Vignette

vignette("axR")

Walks through discovery, status/settings, deployment staging with axivity_stage_device(), downloading, the axivity_copy_data() fallback, and reading .cwa files with axivity_read_cwa().

๐Ÿ“ฆ Dependencies

Package Type Purpose
Rcpp Imports Bridges R to the vendored OMAPI C library
cli Imports read_acttrust()'s error/warning messages
lubridate Imports read_acttrust()'s flexible date-time parsing
tibble Suggests axivity_read_cwa()/read_acttrust()'s return type (falls back to a plain data frame if absent)
testthat Suggests Test suite
covr Suggests Coverage reporting
knitr, rmarkdown, pkgdown Suggests Vignette and documentation site

๐Ÿ‘ฅ Authors

Role Name Affiliation
Author, maintainer Lucas Franรงa Circadia Lab, Northumbria University
Author Mario Leocadio-Miguel Circadia Lab, Northumbria University
Author Daniel Jackson Northumbria University

๐Ÿ“„ Citation

If you use axR in your research, please cite it:

@software{franca_axr_2026,
  author  = {Franรงa, Lucas and Leocadio-Miguel, Mario and Jackson, Daniel},
  title   = {{axR}: Interfacing and Retrieving Data from Accelerometer Devices},
  year    = {2026},
  version = {0.1.3},
  doi     = {10.5281/zenodo.21393892},
  url     = {https://github.com/circadia-bio/axR}
}

๐Ÿค Related Tools

๐Ÿ“„ Licence

Released under the MIT License. Vendored OMAPI code in src/omapi is BSD 2-clause, Copyright ยฉ Newcastle University โ€” see src/omapi/LICENSE.TXT.

Copyright ยฉ Lucas Franรงa, Mario Leocadio-Miguel & Daniel Jackson, 2026