Skip to content

jhuwit/activerse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

activerse

activerse is a lightweight helper package that attaches actibase, actiread, actimetrics, actisensorlog, and actiwalkability together.

It is designed to behave a bit like tidyverse: load one package, then use the functions from the actigraphy packages directly.

Installation

# install.packages("remotes")
remotes::install_github("jhuwit/activerse")

Packages

Package Repository R CMD check
actibase jhuwit/actibase R CMD check
actiread jhuwit/actiread R CMD check
actimetrics jhuwit/actimetrics R CMD check
actisensorlog jhuwit/actisensorlog R CMD check
actiwalkability jhuwit/actiwalkability R CMD check

Load the packages

library(activerse)

# activerse-load:start
search()[grepl("^package:(actibase|actiread|actimetrics|actisensorlog|actiwalkability)$", search())]
#> [1] "package:actimetrics" "package:actiread"    "package:actibase"
# activerse-load:end

Example data

The packages ship with small example datasets that are useful for quick tests.

data(acti_raw_data, package = "actibase")
data(acti_count_data, package = "actimetrics")

head(acti_raw_data)
#>                  time     X      Y     Z
#> 1 2019-09-17 18:40:00 0.000  0.008 0.996
#> 2 2019-09-17 18:40:00 0.016  0.000 1.008
#> 3 2019-09-17 18:40:00 0.020 -0.008 1.004
#> 4 2019-09-17 18:40:00 0.016 -0.012 1.012
#> 5 2019-09-17 18:40:00 0.016 -0.008 1.008
#> 6 2019-09-17 18:40:00 0.008 -0.008 1.008
head(acti_count_data)
#>                  time axis1 axis2 axis3 counts
#> 1 2019-09-17 18:40:00  5435  9659  8253  13818
#> 2 2019-09-17 18:41:00  9125  9197  4131  13598
#> 3 2019-09-17 18:42:00  4404  4367  3494   7119
#> 4 2019-09-17 18:43:00  3267  3170  2543   5214
#> 5 2019-09-17 18:44:00  1405   896   894   1891
#> 6 2019-09-17 18:45:00     0     0     0      0

Use actimetrics

Once activerse is attached, functions from the activerse packages are available directly. You can also call them with the relevant pkg:: prefix if you prefer being explicit.

Calculate ENMO

enmo <- acti_calculate_enmo(data = acti_raw_data)
head(enmo)
#> # A tibble: 6 × 2
#>   HEADER_TIME_STAMP   ENMO_t
#>   <dttm>               <dbl>
#> 1 2019-09-17 18:40:00 0.688 
#> 2 2019-09-17 18:41:00 0.708 
#> 3 2019-09-17 18:42:00 0.183 
#> 4 2019-09-17 18:43:00 0.150 
#> 5 2019-09-17 18:44:00 0.0278
#> 6 2019-09-17 18:45:00 0.0139

Calculate activity index

activity_index <- acti_calculate_activity_index(
  acti_raw_data,
  unit = "1 min",
  ensure_all_time = TRUE,
  verbose = FALSE
)

head(activity_index)
#> # A tibble: 6 × 2
#>   HEADER_TIME_STAMP      AI
#>   <dttm>              <dbl>
#> 1 2019-09-17 18:40:00 23.2 
#> 2 2019-09-17 18:41:00 22.9 
#> 3 2019-09-17 18:42:00 11.9 
#> 4 2019-09-17 18:43:00 10.5 
#> 5 2019-09-17 18:44:00  2.35
#> 6 2019-09-17 18:45:00  0

Calculate MAD

mad <- acti_calculate_mad(data = acti_raw_data)
head(mad)
#> # A tibble: 6 × 8
#>   HEADER_TIME_STAMP       SD   SD_t AI_DEFINED    MAD   MEDAD mean_r ENMO_t
#>   <dttm>               <dbl>  <dbl>      <dbl>  <dbl>   <dbl>  <dbl>  <dbl>
#> 1 2019-09-17 18:40:00 1.87   1.85        1.33  1.09   0.630     1.65 0.688 
#> 2 2019-09-17 18:41:00 1.54   1.53        1.08  0.853  0.552     1.69 0.708 
#> 3 2019-09-17 18:42:00 0.253  0.204       0.278 0.207  0.188     1.14 0.183 
#> 4 2019-09-17 18:43:00 0.228  0.175       0.228 0.191  0.178     1.10 0.150 
#> 5 2019-09-17 18:44:00 0.0815 0.0637      0.309 0.0300 0.00330   1.02 0.0278
#> 6 2019-09-17 18:45:00 0      0           0     0      0         1.01 0.0139

More examples

actimetrics also includes functions for wear/non-wear detection, step count estimation, and other processing helpers:

acti_process(acti_raw_data)
acti_calculate_wear(acti_raw_data)
acti_calculate_nonwear(acti_raw_data)
acti_calculate_stepcount(acti_raw_data)

Updating activerse

When a new package is added to activerse, update the package list, the README, and the attach helper by running:

./scripts/update-activerse.R actisensorlog

If the new package lives under a different GitHub owner, pass --owner=:

./scripts/update-activerse.R --owner=some-owner actisensorlog

The script updates DESCRIPTION, R/activerse.R, and both README files in one pass.

About

Attach Activerse Packages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages