read_acc_csv: Read ActiGraph Accelerometer CSV

View source: R/read_acc_csv.R

read_acc_csvR Documentation

Read ActiGraph Accelerometer CSV

Description

Read ActiGraph Accelerometer CSV

Usage

read_acc_csv(file, ..., only_xyz = TRUE)

extract_acc_header(file)

Arguments

file

CSV file to read in

...

additional arguments to pass to read_csv

only_xyz

should the data be subset for only X/Y/Z values (and time)?

Value

A list of the header and the data set

Examples

file = system.file("extdata", "TAS1H30182785_2019-09-17.csv.gz",
package = "SummarizedActigraphy")
if (file.exists(file)) {
   out = read_acc_csv(file)
   SummarizedActigraphy:::parse_acc_header(file)
}
file = system.file("extdata", "example1sec.csv", package = "AGread")
if (file.exists(file)) {
   out = read_acc_csv(file, only_xyz = FALSE)
   SummarizedActigraphy:::quick_check(out$data)
   acc = out
   class(acc) = "AccData"
   SummarizedActigraphy:::quick_check(acc)
}

file = system.file("extdata", "721431sec.csv.gz",
package = "SummarizedActigraphy")
if (file.exists(file)) {
   out = read_acc_csv(file, only_xyz = FALSE)
   cn = colnames(out$data)
   names(cn) = cn
   cn[c("X1", "X2", "X3", "X4")] = c("Axis1", "Axis2", "Axis3", "Steps")
   colnames(out$data) = cn
   acc = out
   class(acc) = "AccData"
}

muschellij2/SummarizedActigraphy documentation built on Aug. 12, 2024, 5:35 p.m.