Make sure your imported data is in the following format

The first timestamp column should be in POSIXct format.

# test with a sample file shipped with the package
file_path = system.file('extdata', 'mhealth.csv', package='MIMSunit')
df = MIMSunit::import_mhealth_csv(filepath=file_path)
HEADER_TIME_STAMP X Y Z
2017-03-16 12:25:50 0.396 1.249 0.161
2017-03-16 12:25:50 0.373 1.224 0.179
2017-03-16 12:25:50 0.355 1.182 0.179
2017-03-16 12:25:50 0.341 1.148 0.179
2017-03-16 12:25:50 0.326 1.117 0.161

Plot accelerometer’s raw signal

MIMSunit::generate_interactive_plot(df, "Acceleration (g)", c(2,3,4))

Run MIMS-unit algorithm on input data

Compute MIMS-unit values

mims = MIMSunit::mims_unit(df, epoch = '1 sec', dynamic_range = c(-2, 2), output_mims_per_axis = TRUE)
HEADER_TIME_STAMP MIMS_UNIT MIMS_UNIT_X MIMS_UNIT_Y MIMS_UNIT_Z
2017-03-16 12:25:50 0.4904041 0.0946427 0.3055596 0.0902019
2017-03-16 12:25:51 0.5724948 0.1914685 0.3035101 0.0775162
2017-03-16 12:25:52 0.4372073 0.1688716 0.1967192 0.0716166
2017-03-16 12:25:53 0.4564886 0.1513979 0.2152772 0.0898135
2017-03-16 12:25:54 0.3866534 0.1262016 0.1772661 0.0831857

Plot MIMS-unit values

MIMSunit::generate_interactive_plot(mims, "MIMS-unit values", c(2,3,4,5))