Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

actipy

R-CMD-check Codecov test coverage

The goal of actipy is to provide R wrappers for the Python actipy package.

Installation

Install the Python Module

The R package uses reticulate to call Python. With a managed reticulate environment, the Python dependency can be declared with:

Sys.setenv(RETICULATE_PYTHON = "managed")
reticulate::py_require("actipy", python_version = "3.10")

You can check whether the Python module is available with:

actipy::have_actipy()
actipy::actipy_version()

Usage

Device Files

Use acti_py_read_device() to read and process a supported accelerometer device file:

library(actipy)

out = acti_py_read_device(
  system.file("extdata/ax3_testfile.cwa.gz", package = "actipy"),
  lowpass_hz = 20,
  calibrate_gravity = TRUE,
  detect_nonwear = TRUE,
  resample_hz = 50
)
#> Decompressing...Decompressing... Done! (0.00s)
#> Reading file...Reading file... Done! (0.27s)
#> Converting to dataframe...Converting to dataframe... Done! (0.03s)
#> Quality control...Quality control... Done! (0.02s)
#> Lowpass filter...Lowpass filter... Done! (0.07s)
#> Gravity calibration...Gravity calibration... Done! (0.02s)
#> Nonwear detection...Nonwear detection... Done! (0.03s)
#> Resampling...Resampling... Done! (0.03s)

data = out$data
info = out$info

Data Frames

Use acti_py_process() for an existing R data frame. The data frame must contain time, x, y, and z columns.

data = data.frame(
  time = as.POSIXct("2024-01-01 00:00:00", tz = "UTC") + 0:99 / 10,
  x = 0,
  y = 0,
  z = 1
)

out = acti_py_process(data, sample_rate = 10)

About

Process Wearable Sensor Data with 'actipy'

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages