export_to_actilife: Export accelerometer data in Actilife RAW CSV format

View source: R/export_data.R

export_to_actilifeR Documentation

Export accelerometer data in Actilife RAW CSV format

Description

export_to_actilife exports the input dataframe as a csv file that is compatible with Actilife.

Usage

export_to_actilife(
  df,
  filepath,
  actilife_version = "6.13.3",
  firmware_version = "1.6.0"
)

Arguments

df

dataframe. Input accelerometer data. The first column is timestamp in POSXlct format, and the rest columns are accelerometer values in g (9.81m/s^2).

filepath

string. The output filepath.

actilife_version

string. The Actilife version number to be added to the header. Default is "6.13.3", that was used by the algorithm during development.

firmware_version

string. The firmware version number to be added to the header. This is supposed to be the firmware version of the Actigraph devices. We did not see any usage of the number during the computation of Actigraph counts by Actilife, so it may be set with an arbitrary version code seen in any Actigraph devices. We use default version code "1.6.0".

Details

This function takes an input accelerometer dataframe and exports it in Actilife RAW CSV format with a prepended a madeup header. The exported file csv file has compatible header, column names, timestamp format with Actilife and can be imported directly into Actilife software.

Value

No return value.

How is it used in MIMS-unit algorithm?

This function is an utility function that was used to convert validation data into Actilife RAW CSV format so that we can use Actilife to compute Actigraph counts values for these data.

See Also

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

Examples

  # Use the first 5 rows from sample data
  df = sample_raw_accel_data[1:5,]
  head(df)

  # Save to current path with default mocked actilife and firmware versions
  filepath = tempfile()
  export_to_actilife(df, filepath)

  # The saved file will have the same format as Actigraph csv files
  readLines(filepath)

  # Cleanup
  file.remove(filepath)

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