import_enmo_csv imports ENMO data stored in a summary csv format, which was exported by the biobank data analysis tools.

import_enmo_csv(filepath, enmo_col = 2)

Arguments

filepath

string. The filepath of the input data.

enmo_col

number. The index of column of ENMO values in the csv file.

Value

dataframe. The imported ENMO data, with the first column being the timestamps in POSIXct format, and the second column being the ENMO values. Column names: HEADER_TIME_STAMP, ENMO.

How is it used in MIMS-unit algorithm?

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

Examples

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

  # Check original data format
  readLines(filepath)[1:5]
#> [1] "Time,enmoTrunc,xRange,yRange,zRange,xStd,yStd,zStd,temp,samples,dataErrors,clipsBeforeCalibr,clipsAfterCalibr,rawSamples"
#> [2] "2018-06-14 11:20:00.000,0.015446,0.523091,0.481628,1.421372,0.029917,0.027709,0.023821,0.00,500,0,0,0,150"               
#> [3] "2018-06-14 11:20:05.000,0.012708,0.008064,0.003874,1.020101,0.001860,0.000763,0.008245,0.00,500,0,0,0,149"               
#> [4] "2018-06-14 11:20:10.000,0.012764,0.007945,0.003991,1.020371,0.001780,0.000834,0.008228,0.00,500,0,0,0,149"               
#> [5] "2018-06-14 11:20:15.000,0.013275,0.007945,0.003749,1.020371,0.001595,0.000578,0.002993,0.00,500,0,0,0,150"               

  # Load file, default column for enmo values are 2
  output = import_enmo_csv(filepath, enmo_col=2)
#> Rows: 499 Columns: 14
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: ","
#> dbl  (13): enmoTrunc, xRange, yRange, zRange, xStd, yStd, zStd, temp, sample...
#> dttm  (1): Time
#> 
#>  Use `spec()` to retrieve the full column specification for this data.
#>  Specify the column types or set `show_col_types = FALSE` to quiet this message.

  # Check output
  head(output)
#>     HEADER_TIME_STAMP     ENMO
#> 1 2018-06-14 11:20:00 0.015446
#> 2 2018-06-14 11:20:05 0.012708
#> 3 2018-06-14 11:20:10 0.012764
#> 4 2018-06-14 11:20:15 0.013275
#> 5 2018-06-14 11:20:20 0.012857
#> 6 2018-06-14 11:20:25 0.012553