`compute_orientation`

returns a dataframe with accelerometer
orientations estimated by
Mizell,
2003 for the input dataframe.

compute_orientation(df, estimation_window = 2, unit = "deg")

df | dataframe. Input multi-channel signal. First column should be timestamps in POSIXt format. |
---|---|

estimation_window | number. window size in seconds to be used to estimate orientations. Default is 2 (seconds), as suggested by Mizell, 2003. |

unit | string. The unit of orientation angles. Can be "deg" (degree) or "rad" (radian). Default is "deg". |

dataframe. The returned dataframe will have the same format as input dataframe.

This function accepts a dataframe (in mhealth accelerometer data format) and
computes the estimated acclerometer orientations (in x, y, and z angles) for
every `estimation_window`

seconds of the entire sequence, and outputs
the mean of these angles. The returned dataframe will have the same format as
input dataframe, including four columns, and have the same datetime format as
input dataframe in the timestamp column. The orientation estimation method
used in the function is based on
Mizell,
2003.

This function is used in
function (`aggregate_for_orientation`

).

Other transformation functions:
`sum_up()`

,
`vector_magnitude()`

# Use first 10 second sample data for testing df = sample_raw_accel_data df = clip_data(df, start_time = df[1,1], stop_time = df[1, 1] + 600) # compute orientation angles in degrees compute_orientation(df)#> HEADER_TIME_STAMP X_ANGLE Y_ANGLE Z_ANGLE #> 1 2016-01-15 11:00:00.013 10.98163 90.54295 100.8922# compute orientation angles in radian angles compute_orientation(df, unit='rad')#> HEADER_TIME_STAMP X_ANGLE Y_ANGLE Z_ANGLE #> 1 2016-01-15 11:00:00.013 0.1916657 1.580273 1.760901