| Title: | Calculate 'ActiGraph' Counts from Accelerometer Data |
|---|---|
| Description: | Calculate 'ActiGraph' counts from the X, Y, and Z axes of a triaxial accelerometer. This work was inspired by Neishabouri et al. who published the article "Quantification of Acceleration as Activity Counts in 'ActiGraph' Wearables" on February 24, 2022. The link to the article (<https://pubmed.ncbi.nlm.nih.gov/35831446>) and 'python' implementation of this code (<https://github.com/actigraph/agcounts>). |
| Authors: | Brian C. Helsel [aut, cre], Paul R. Hibbing [ctb], Robert N. Montgomery [ctb], Eric D. Vidoni [ctb], Jonathan Clutton [ctb], John Muschelli [ctb], University of Kansas [cph] |
| Maintainer: | Brian C. Helsel <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.7.0 |
| Built: | 2026-06-03 18:36:31 UTC |
| Source: | https://github.com/bhelsel/agcounts |
This function uses a C++ implementation of the GGIR 'g.calibrate' function.
agcalibrate( raw, verbose = FALSE, tz = "UTC", imputeTimeGaps = FALSE, spherecrit = 0.3, sdcriter = 0.013, minloadcrit = 168L, debug = FALSE, ... )agcalibrate( raw, verbose = FALSE, tz = "UTC", imputeTimeGaps = FALSE, spherecrit = 0.3, sdcriter = 0.013, minloadcrit = 168L, debug = FALSE, ... )
raw |
data frame of raw acceleration data obtained from |
verbose |
Print the progress of the calibration for the raw data, Default: FALSE |
tz |
the desired timezone, Default: |
imputeTimeGaps |
Imputes gaps in the raw acceleration data, Default: FALSE |
spherecrit |
The minimum required acceleration value (in g) on both sides of 0 g for each axis. Used to judge whether the sphere is sufficiently populated |
sdcriter |
Criteria to define non-wear time, defined as the estimated noise measured in the raw accelerometer data. |
minloadcrit |
The minimum number of hours the code needs to read for the autocalibration procedure to be effective (only sensitive to multitudes of 12 hrs, other values will be ceiled) |
debug |
print out diagnostic information for C++ code |
... |
Additional arguments to pass into the agread function |
This function uses a C++ implementation of the GGIR 'g.calibrate' function to return calibrated raw acceleration data.
Returns the calibrated raw acceleration data
path <- system.file("extdata/example.gt3x", package = "agcounts") data <- read.gt3x::read.gt3x(path, asDataFrame = TRUE) data <- agcalibrate(raw = data)path <- system.file("extdata/example.gt3x", package = "agcounts") data <- read.gt3x::read.gt3x(path, asDataFrame = TRUE) data <- agcalibrate(raw = data)
This R Package reads the X, Y, and Z axes in a GT3X accelerometer file and converts it to Actigraphy counts. This work was inspired by Neishabouri et al. who published the article "Quantification of Acceleration as Activity Counts in ActiGraph Wearables on February 24, 2022. The link to the article and Python implementation of this code https://github.com/actigraph/agcounts.
This function reads in raw acceleration data with the pygt3x Python package, the read.gt3x R package with GGIR autocalibration, or the read.gt3x R package.
agread( path, parser = c("pygt3x", "GGIR", "read.gt3x"), tz = "UTC", verbose = FALSE, ... )agread( path, parser = c("pygt3x", "GGIR", "read.gt3x"), tz = "UTC", verbose = FALSE, ... )
path |
Path name to the GT3X file or the dataset with columns time, X, Y, and Z axis |
parser |
The parser to use when reading in the data. Parser values include pygt3x, GGIR, and read.gt3x options. |
tz |
the desired timezone, Default: |
verbose |
Print the read method, Default: FALSE. |
... |
Additional arguments to pass into the agread function |
This function reads in raw acceleration data with the pygt3x Python package, the read.gt3x R package with GGIR autocalibration, or the read.gt3x R package.
Returns the raw acceleration data
agread(system.file("extdata/example.gt3x", package = "agcounts"), parser = "pygt3x")agread(system.file("extdata/example.gt3x", package = "agcounts"), parser = "pygt3x")
This function deploys the agcounts Shiny app.
agShinyDeployApp(...)agShinyDeployApp(...)
... |
arguments passed to |
This function deploys the agcounts Shiny app for data visualization and exploration. It also provides an opportunity to compare ActiGraph counts generated from the agcounts package with those from ActiGraph's .agd files.
Deploys a Shiny app on localhost. No data or values are returned.
fluidPage, titlePanel, reexports, shinyApp
bs_theme
Calculate ActiGraph activity counts from raw acceleration data
by passing in a data frame with a time stamp, X, Y, and Z axis. This function
allows the ability to work with the raw data from other files, but the data
frame needs to have "start_time" and "stop_time" attributes. This is different
from the get_counts function because it reads a raw
data frame rather than a path name to a GT3X file.
calculate_counts(raw, epoch, lfe_select = FALSE, tz = "UTC", verbose = FALSE)calculate_counts(raw, epoch, lfe_select = FALSE, tz = "UTC", verbose = FALSE)
raw |
data frame of raw acceleration data obtained from
|
epoch |
The epoch length for which the counts should be summed. |
lfe_select |
Apply the Actigraph Low Frequency Extension filter, Default: FALSE |
tz |
the desired timezone, Default: |
verbose |
Print the progress of the Actigraph raw data conversion to counts, Default: FALSE. |
Returns a data.frame containing the ActiGraph count values
f <- system.file("extdata/example.gt3x", package = "agcounts") d <- read.gt3x::read.gt3x(f, asDataFrame = TRUE, imputeZeroes = TRUE) calculate_counts(d, 60)f <- system.file("extdata/example.gt3x", package = "agcounts") d <- read.gt3x::read.gt3x(f, asDataFrame = TRUE, imputeZeroes = TRUE) calculate_counts(d, 60)
Main function to extract counts from the Actigraph GT3X Files.
get_counts( path, epoch, lfe_select = FALSE, write.file = FALSE, return.data = TRUE, verbose = FALSE, tz = "UTC", parser = c("pygt3x", "GGIR", "read.gt3x"), ... )get_counts( path, epoch, lfe_select = FALSE, write.file = FALSE, return.data = TRUE, verbose = FALSE, tz = "UTC", parser = c("pygt3x", "GGIR", "read.gt3x"), ... )
path |
Full path name to the GT3X File |
epoch |
The epoch length for which the counts should be summed. |
lfe_select |
Apply the Actigraph Low Frequency Extension filter, Default: FALSE |
write.file |
Export a CSV file of the counts, Default: FALSE |
return.data |
Return the data frame to the R Global Environment, Default: TRUE |
verbose |
Print the progress of the Actigraph raw data conversion to counts, Default: FALSE. |
tz |
the desired timezone, Default: |
parser |
The parser to use when reading in the data. Parser values include pygt3x, GGIR, and read.gt3x options. |
... |
arguments passed to |
Main function to extract counts from the Actigraph GT3X Files.
Writes a CSV file if write.file is TRUE and returns a data.frame if return.data is TRUE
get_counts( path = system.file("extdata/example.gt3x", package = "agcounts"), epoch = 60, lfe_select = FALSE, write.file = FALSE, return.data = TRUE )get_counts( path = system.file("extdata/example.gt3x", package = "agcounts"), epoch = 60, lfe_select = FALSE, write.file = FALSE, return.data = TRUE )