Filter the acceleration signal using a butterworth digital filter.
Arguments
- data
An
impactr_data
object, as obtained with read_acc().- order
The order of the filter. Defaults to 4.
- cutoff
The filter cut-off frequency in Hz. Defaults to 20. For low- and high-pass filters, must be a scalar. For band-pass and band- stop, a vector of length two.
- type
The type of filter. Defaults to "lowpass". Can be "lowpass", "highpass", "bandpass" or "bandstop".
Details
The default values of the filter parameters are matching the filter used in the paper by Veras et al. that developed the mechanical loading prediction equations (see References).
References
Veras L, Diniz-Sousa F, Boppre G, Devezas V, Santos-Sousa H, Preto J, Machado L, Vilas- Boas JP, Oliveira J, Fonseca H. Accelerometer-based prediction of skeletal mechanical loading during walking in normal weight to severely obese subjects. Osteoporosis International. 2020. 31(7):1239- 1250. doi:10.1007/s00198-020-05295-2 .
Examples
data <- read_acc(impactr_example("hip-raw.csv"))
filter_acc(data)
#> # Start time: 2021-04-06 15:43:00
#> # Sampling frequency: 100Hz
#> # Accelerometer placement: Non-specified
#> # Subject body mass: Non-specified
#> # Filter: Butterworth (4th-ord, low-pass, 20Hz)
#> # Data dimensions: 30,000 × 4
#> timestamp acc_X acc_Y acc_Z
#> <dttm> <dbl> <dbl> <dbl>
#> 1 2021-04-06 15:43:00 0.180 -0.483 0.0182
#> 2 2021-04-06 15:43:00 0.254 -0.738 0.0948
#> 3 2021-04-06 15:43:00 0.276 -0.876 0.216
#> 4 2021-04-06 15:43:00 0.268 -0.909 0.315
#> 5 2021-04-06 15:43:00 0.269 -0.892 0.327
#> 6 2021-04-06 15:43:00 0.298 -0.878 0.259
#> 7 2021-04-06 15:43:00 0.340 -0.906 0.185
#> 8 2021-04-06 15:43:00 0.360 -0.978 0.164
#> 9 2021-04-06 15:43:00 0.340 -1.03 0.188
#> 10 2021-04-06 15:43:00 0.305 -0.978 0.234
#> # … with 29,990 more rows
#> # ℹ Use `print(n = ...)` to see more rows