import_mhealth_csv imports the raw multi-channel accelerometer data stored in mHealth Specification. Note that this function will fail when loading data that have size too big to fit in the memory. For large data file, please use import_mhealth_csv_chunked to load.

import_mhealth_csv(filepath)

Arguments

filepath

string. The filepath of the input data.

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 stored in mHealth Specification during algorithm validation.

Examples

  default_ops = options()
  options(digits.secs=3)
  # Use the sample mhealth csv file provided by the package
  filepath = system.file('extdata', 'mhealth.csv', package='MIMSunit')
  filepath
#> [1] "/home/runner/.cache/R/renv/library/MIMSunit-c67c22f2/R-4.2/x86_64-pc-linux-gnu/MIMSunit/extdata/mhealth.csv"

  # Load the file
  df = import_mhealth_csv(filepath)

  # Check loaded file
  head(df)
#>     HEADER_TIME_STAMP     X     Y     Z
#> 1 2017-03-16 12:25:50 0.396 1.249 0.161
#> 2 2017-03-16 12:25:50 0.373 1.224 0.179
#> 3 2017-03-16 12:25:50 0.355 1.182 0.179
#> 4 2017-03-16 12:25:50 0.341 1.148 0.179
#> 5 2017-03-16 12:25:50 0.326 1.117 0.161
#> 6 2017-03-16 12:25:50 0.303 1.078 0.167

  # Check more
  summary(df)
#>  HEADER_TIME_STAMP                      X                Y        
#>  Min.   :2017-03-16 12:25:50.00   Min.   :0.1410   Min.   :0.721  
#>  1st Qu.:2017-03-16 12:25:51.50   1st Qu.:0.2647   1st Qu.:0.864  
#>  Median :2017-03-16 12:25:52.99   Median :0.3990   Median :1.029  
#>  Mean   :2017-03-16 12:25:52.99   Mean   :0.4170   Mean   :1.064  
#>  3rd Qu.:2017-03-16 12:25:54.49   3rd Qu.:0.5713   3rd Qu.:1.252  
#>  Max.   :2017-03-16 12:25:55.99   Max.   :0.7680   Max.   :1.554  
#>        Z          
#>  Min.   :-0.2380  
#>  1st Qu.:-0.0150  
#>  Median : 0.1155  
#>  Mean   : 0.0806  
#>  3rd Qu.: 0.1700  
#>  Max.   : 0.2790  

  # Restore default options
  options(default_ops)