Skip to contents

[Experimental]

Applies smoothing filters to movement tracking data to reduce noise.

Usage

filter_movement(
  data,
  method = c("rollmedian", "rollmean", "kalman", "sgolay", "lowpass", "highpass",
    "lowpass_fft", "highpass_fft"),
  use_derivatives = FALSE,
  ...
)

Arguments

data

A data frame containing movement tracking data with the following required columns:

  • individual: Identifier for each tracked subject

  • keypoint: Identifier for each tracked point

  • x: x-coordinates

  • y: y-coordinates

  • time: Time values Optional columns:

  • z: z-coordinates

method

Character string specifying the smoothing method. Options:

use_derivatives

Filter on the derivative values instead of coordinates (important for e.g. trackball or accelerometer data)

...

Additional arguments passed to the specific filter function

Value

A data frame with the same structure as the input, but with smoothed coordinates.

Details

This function is a wrapper that applies various filtering methods to x and y (and z if present) coordinates. Each filtering method has its own specific parameters - see the documentation of individual filter functions for details:

Examples

if (FALSE) { # \dontrun{
# Apply rolling median with window of 5
filter_movement(tracking_data, "rollmedian", window_width = 5, min_obs = 1)
} # }