import_actigraph_csv: Import raw multi-channel accelerometer data stored in...

View source: R/import_data.R

import_actigraph_csvR Documentation

Import raw multi-channel accelerometer data stored in Actigraph raw csv format

Description

import_actigraph_csv imports the raw multi-channel accelerometer data stored in Actigraph raw csv format. It supports files from the following devices: GT3X, GT3X+, GT3X+BT, GT9X, and GT9X-IMU.

Usage

import_actigraph_csv(
  filepath,
  in_voltage = FALSE,
  has_ts = TRUE,
  header = TRUE
)

Arguments

filepath

string. The filepath of the input data. The first column of the input data should always include timestamps.

in_voltage

set as TRUE only when the input Actigraph csv file is in analog quantized format and need to be converted into g value

has_ts

boolean. If TRUE, the input csv file will have a timestamp column.

header

boolean. If TRUE, the input csv file will have column names in the first row.

Details

For old device (GT3X) that stores accelerometer values as digital voltage. The function will convert the values to g unit using the following equation.

x_g = \frac{x_{voltage}r}{(2 ^ r) - \frac{v}{2}}

Where v is the max voltage corresponding to the max accelerometer value that can be found in the meta section in the csv file; r is the resolution level which is the number of bits used to store the voltage values. r can also be found in the meta section in the csv file.

Value

dataframe. The imported multi-channel accelerometer signal, with the first column being the timestamps in POSXlct format, and the rest columns being accelerometer values in g unit.

How is it used in MIMS-unit algorithm?

This function is a File IO function that is used to import data from Actigraph devices during algorithm validation.

See Also

Other File I/O functions: export_to_actilife(), import_actigraph_count_csv(), import_actigraph_csv_chunked(), import_actigraph_meta(), import_activpal3_csv(), import_enmo_csv(), import_mhealth_csv_chunked(), import_mhealth_csv()

Examples

  default_ops = options()
  options(digits.secs=3)

  # Use the sample actigraph csv file provided by the package
  filepath = system.file('extdata', 'actigraph_timestamped.csv', package='MIMSunit')

  # Check file format
  readLines(filepath)[1:15]

  # Load the file with timestamp column
  df = import_actigraph_csv(filepath)

  # Check loaded file
  head(df)

  # Check more
  summary(df)

  # Use the sample actigraph csv file without timestamp
  filepath = system.file('extdata', 'actigraph_no_timestamp.csv', package='MIMSunit')

  # Check file format
  readLines(filepath)[1:15]

  # Load the file without timestamp column
  df = import_actigraph_csv(filepath, has_ts = FALSE)

  # Check loaded file
  head(df)

  # Check more
  summary(df)

  # Restore default options
  options(default_ops)

MIMSunit documentation built on June 21, 2022, 5:06 p.m.