import_actigraph_count_csv imports Actigraph count data stored in Actigraph summary csv format, which was exported by Actilife.

import_actigraph_count_csv(
  filepath,
  count_col = 2,
  count_per_axis_cols = c(2, 3, 4)
)

Arguments

filepath

string. The filepath of the input data.

count_col

number. The index of column of Actigraph count (combined axes). If it is NULL, the function will use count_per_axis_cols to get the combined Actigraph count values.

count_per_axis_cols

numerical vector. The indices of columns of Actigraph count values per axis. If count_col is not NULL, the argument will be ignored. If it is NULL, the output dataframe will only have two columns without Actigraph count values per axis.

Value

dataframe. The imported actigraph count data, with the first column being the timestamps in POSIXct format, and the second column being the combined Actigraph count values, and the rest of columns being the Actigraph cont values per axis if available. Column names:

HEADER_TIME_STAMP, ACTIGRAPH_COUNT,

ACTIGRAPH_COUNT_X....

Note

If both count_col and count_per_axis_cols are NULL, the function will raise an error.

How is it used in MIMS-unit algorithm?

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

Examples

  # Use the actigraph count csv file shipped with the package
  filepath = system.file('extdata', 'actigraph_count.csv', package='MIMSunit')

  # Check original data format
  readLines(filepath)[1:5]
#> [1] "timestamp,vectormagnitude" "2018-06-14 11:27:00,0"    
#> [3] "2018-06-14 11:27:05,0"     "2018-06-14 11:27:10,0"    
#> [5] "2018-06-14 11:27:15,0"    

  # Load file, default column for actigraph count values are 2, this file does not have
  # axial count values
  output = import_actigraph_count_csv(filepath, count_col=2)

  # Check output
  head(output)
#>     HEADER_TIME_STAMP ACTIGRAPH_COUNT
#> 1 2018-06-14 11:27:00               0
#> 2 2018-06-14 11:27:05               0
#> 3 2018-06-14 11:27:10               0
#> 4 2018-06-14 11:27:15               0
#> 5 2018-06-14 11:27:20               0
#> 6 2018-06-14 11:27:25               0