Skip to contents

[Experimental]

Applies smoothing filters to movement tracking data to reduce noise.

Usage

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

Arguments

data

An aniframe. Spatial columns to filter are taken from the metadata field variables_where (e.g. c("x", "y") or c("x", "y", "z")). Filtering is applied within the aniframe's existing grouping, which is driven by variables_what (e.g. c("individual", "keypoint"), "track", or character(0) for a single trajectory). Single-track data without an individual column is supported.

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

An aniframe with the same structure as the input, but with smoothed spatial coordinates.

Details

This function is a wrapper that applies the chosen filter to every spatial coordinate listed in variables_where, respecting the aniframe's existing grouping. Each filtering method has its own specific parameters - see the documentation of the individual filter functions for details:

Examples

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