Skip to contents

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)
}
#> $serial
#> [1] "TAS1H30182785"
#> 
#> $start_time
#> [1] "18:40:00"
#> 
#> $start_date
#> [1] "9/17/2019"
#> 
#> $epoch
#> [1] "00:00:00"
#> 
#> $download_time
#> [1] "19:20:05"
#> 
#> $download_date
#> [1] "9/17/2019"
#> 
#> $battery_voltage
#> [1] "4.18"
#> 
#> $memory_address
#> [1] "0"
#> 
#> $mode
#> [1] "12"
#> 
#> $firmware
#> [1] "1.7.2"
#> 
#> $actilife_version
#> [1] "6.13.3"
#> 
#> $filter
#> [1] "Normal"
#> 
#> $date_format
#> [1] "mdy"
#> 
#> $sample_rate
#> [1] 100
#> 
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"
}
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> Warning: Sample rate is NA, using epoch: 00:00:01
#> Warning: Guessing sample_rate from the data