View source: R/read_actigraphy.R
read_actigraphy | R Documentation |
Read Actigraphy File
read_actigraphy(file, ..., read_function = NULL)
file |
file to read |
... |
additional arguments to pass to function |
read_function |
A custom function to read the data in. |
An accelerometer object from the function used to read the file.
file = system.file("extdata",
"TAS1H30182785_2019-09-17.gt3x",
package = "SummarizedActigraphy")
res = read_actigraphy(file)
testthat::expect_equal(mean(res$data$X), -0.0742151351351352)
file = "blah.exe"
testthat::expect_error(read_actigraphy(file))
url = paste0("https://github.com/THLfi/read.gt3x/files/",
"3522749/GT3X%2B.01.day.gt3x.zip")
destfile = tempfile(fileext = ".zip")
dl = utils::download.file(url, destfile = destfile, mode = "wb")
gt3x_file = utils::unzip(destfile, exdir = tempdir())
gt3x_file = gt3x_file[!grepl("__MACOSX", gt3x_file)]
path = gt3x_file
res = read_actigraphy(path)
testthat::expect_equal(mean(res$data$X), -0.228406351135833)
dob = res$header$Value[res$header$Field == "DateOfBirth"]
if (length(dob) > 0) {
SummarizedActigraphy:::ticks2datetime(dob)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.