Introduces the smoothing function smooth_timeseries()
which applies a Kolmogorov-Zurbenko filter. This functionality is based upon a code example from the Envision Bootcamp by @WimPouw and James Trujillo.
How-to:
When placed directly in the demo
folder, the following code demonstrates how the new smoothing function works:
# Install lastest OpenPoseR package from Github and load package
devtools::install_github("trettenbrein/OpenPoseR")
require(OpenPoseR)
# Load data from file in "demo" folder and plot
data <- read.csv("data_openposer/psychologie_body25_cleaned_en_velocity.csv", sep="")
plot_timeseries(data)
# Apply filter and plot result
filtered_data <- smooth_timeseries(data$Euclidean_norm_velocity, span = 2, order = 2)
plot_timeseries(data.frame(filtered_data))
Alternatively, there also is a wrapper function file_smooth_timeseries()
that makes it possible to simply pass an output file to the smoothing function and have the result saved to a new file psychologie_body25_cleaned_en_velocity_smoothed.csv
:
file_smooth_timeseries("data_openposer/psychologie_body25_cleaned_en_velocity.csv", span = 2, order = 2)