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:49 0.417 1.277 0.152
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

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 = '5 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:49 -0.010000 -0.0100000 -0.0100000 -0.0100000
2017-03-16 12:25:54 2.145886 0.7639568 0.9771606 0.4047688
2017-03-16 12:25:59 2.186345 0.7715398 1.0219486 0.3928569
2017-03-16 12:26:04 2.395308 0.7724545 1.1861811 0.4366727
2017-03-16 12:26:09 2.226498 0.7074428 1.1451174 0.3739379

Plot MIMS-unit values

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