From e2f928c2b57fda9f60b4c1c66494f2dabf7e06a0 Mon Sep 17 00:00:00 2001 From: muschellij2 Date: Tue, 5 May 2026 14:22:07 -0400 Subject: [PATCH 1/4] added a test --- DESCRIPTION | 3 ++- R/agread.R | 10 +++++----- tests/testthat/test_agread.R | 3 +++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7472a52..fc68269 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,13 +1,14 @@ Package: agcounts Type: Package Title: Calculate 'ActiGraph' Counts from Accelerometer Data -Version: 0.6.9 +Version: 0.7.0 Authors@R: c( person(c("Brian", "C."), "Helsel", email = "bhelsel@kumc.edu", role = c("aut", "cre")), person(c("Paul", "R."), "Hibbing", role = "ctb"), person(c("Robert N."), "Montgomery", role = "ctb"), person(c("Eric D."), "Vidoni", role = "ctb"), person("Jonathan", "Clutton", role = "ctb"), + person("John", "Muschelli", role = "ctb"), person("University of Kansas", role = "cph") ) Description: Calculate 'ActiGraph' counts from the X, Y, and Z axes of a triaxial diff --git a/R/agread.R b/R/agread.R index 243d42f..0aefe17 100644 --- a/R/agread.R +++ b/R/agread.R @@ -30,9 +30,9 @@ agread <- function(path, parser = c("pygt3x", "GGIR", "read.gt3x"), tz = "UTC", parser <- "GGIR" } switch(parser, - "pygt3x" = .pygt3xReader(path = path, verbose = verbose, ...), - "GGIR" = .ggirReader(path = path, verbose = verbose, ...), - "read.gt3x" = .gt3xReader(path = path, verbose = verbose, ...), + "pygt3x" = .pygt3xReader(path = path, verbose = verbose, tz = tz, ...), + "GGIR" = .ggirReader(path = path, verbose = verbose, tz = tz, ...), + "read.gt3x" = .gt3xReader(path = path, verbose = verbose, tz = tz, ...), stop("No method exists yet for ", sQuote(parser), call. = FALSE) ) } @@ -56,7 +56,7 @@ agread <- function(path, parser = c("pygt3x", "GGIR", "read.gt3x"), tz = "UTC", # Return Data colnames(raw) <- c("time", "X", "Y", "Z") raw$time <- as.POSIXct(raw$time, origin = "1970-01-01 00:00:00", tz=tz) - meta <- read.gt3x::parse_gt3x_info(path) + meta <- read.gt3x::parse_gt3x_info(path, tz = tz) attr(raw, "start_time") <- meta$`Start Date` %>% lubridate::force_tz(tz) attr(raw, "stop_time") <- meta$`Stop Date` %>% lubridate::force_tz(tz) raw @@ -66,7 +66,7 @@ agread <- function(path, parser = c("pygt3x", "GGIR", "read.gt3x"), tz = "UTC", if(verbose) print("Reading data with read.gt3x and calibrating with GGIR.") I <- GGIR::g.inspectfile(datafile = path) C <- GGIR::g.calibrate(datafile = path, use.temp = FALSE, printsummary = FALSE, inspectfileobject = I) - raw <- read.gt3x::read.gt3x(path, asDataFrame = TRUE, imputeZeroes = TRUE) + raw <- .gt3xReader(path, tz = tz, verbose = verbose, ...) raw[, 2:4] <- scale(raw[, 2:4], center = -C$offset, scale = 1/C$scale) if(C$nhoursused==0) message("\n There is not enough data to perform the GGIR autocalibration method. Returning data as read by read.gt3x.") raw diff --git a/tests/testthat/test_agread.R b/tests/testthat/test_agread.R index 7a9c367..e0ee9a3 100644 --- a/tests/testthat/test_agread.R +++ b/tests/testthat/test_agread.R @@ -21,6 +21,9 @@ testthat::test_that("Check that data can be read into agcounts using each agread expect_equal(nrow(rawData), 18000) expect_equal(ncol(rawData), 4) + invisible(capture.output(rawData <- agread(path = file, parser = "read.gt3x", verbose = FALSE, tz = "EST"))) + expect_true(lubridate::tz(rawData$time) == "EST") + raw <- read.gt3x(path = file, asDataFrame = TRUE) sf <- agcounts:::.get_frequency(raw) invisible(capture.output(agcalibrated <- agcalibrate(raw))) From c05fc4f4597dba1000e2588cc2287eb31208cbca Mon Sep 17 00:00:00 2001 From: muschellij2 Date: Tue, 5 May 2026 14:22:25 -0400 Subject: [PATCH 2/4] added DESCRIPTION --- DESCRIPTION | 1 - 1 file changed, 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index fc68269..882f054 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,7 +21,6 @@ Depends: License: MIT + file LICENSE Encoding: UTF-8 LazyData: true -RoxygenNote: 7.3.1 Imports: data.table, gsignal, From d40a8c3c0e57418d0d2b420051e458803a0ed4a8 Mon Sep 17 00:00:00 2001 From: muschellij2 Date: Wed, 20 May 2026 14:33:23 -0400 Subject: [PATCH 3/4] new roxygen --- DESCRIPTION | 1 + 1 file changed, 1 insertion(+) diff --git a/DESCRIPTION b/DESCRIPTION index 882f054..8ecce85 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -54,3 +54,4 @@ LinkingTo: RcppArmadillo URL: https://github.com/bhelsel/agcounts BugReports: https://github.com/bhelsel/agcounts/issues +Config/roxygen2/version: 8.0.0 From faa9584c4dc86182a559e54723e2293235c2bde0 Mon Sep 17 00:00:00 2001 From: muschellij2 Date: Wed, 20 May 2026 14:37:41 -0400 Subject: [PATCH 4/4] added package --- man/agcounts-package.Rd | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/man/agcounts-package.Rd b/man/agcounts-package.Rd index 324946e..67ab663 100644 --- a/man/agcounts-package.Rd +++ b/man/agcounts-package.Rd @@ -5,11 +5,7 @@ \alias{agcounts-package} \title{agcounts: 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 (\url{https://pubmed.ncbi.nlm.nih.gov/35831446}) - and 'python' implementation of this code (\url{https://github.com/actigraph/agcounts}). +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 (\url{https://pubmed.ncbi.nlm.nih.gov/35831446}) and 'python' implementation of this code (\url{https://github.com/actigraph/agcounts}). } \seealso{ Useful links: @@ -22,12 +18,18 @@ Useful links: \author{ \strong{Maintainer}: Brian C. Helsel \email{bhelsel@kumc.edu} +Authors: +\itemize{ + \item Brian C. Helsel \email{bhelsel@kumc.edu} +} + Other contributors: \itemize{ \item Paul R. Hibbing [contributor] \item Robert N. Montgomery [contributor] \item Eric D. Vidoni [contributor] \item Jonathan Clutton [contributor] + \item John Muschelli [contributor] \item University of Kansas [copyright holder] }