These functions use a moving window to smooth data
moving_average(
formula = NULL,
data = NULL,
x = NULL,
y = NULL,
window_width_n = NULL,
window_width = NULL,
window_width_n_frac = NULL,
window_width_frac = NULL,
na.rm = TRUE,
warn_nonnumeric_sort = TRUE
)moving_median(
formula = NULL,
data = NULL,
x = NULL,
y = NULL,
window_width_n = NULL,
window_width = NULL,
window_width_n_frac = NULL,
window_width_frac = NULL,
na.rm = TRUE,
warn_nonnumeric_sort = TRUE
)
Vector of smoothed data, with NA's appended at both ends
Formula specifying the numeric response (density) and numeric predictor (time).
Dataframe containing variables in formula
A vector of predictor values to smooth along (e.g. time)
A vector of response values to be smoothed (e.g. density).
Number of data points wide the moving window is (therefore, must be an odd number of points)
Width of the moving window (in units of x
)
Width of the window (as a fraction of the total number of data points).
Width of the window (as a fraction of the range of
x
)
logical whether NA's should be removed before analyzing
logical whether warning should be issued when predictor variable that data is sorted by is non-numeric.
Either x
and y
or formula
and data
must be provided.
Values of NULL
or NA
will be ignored for any of
window_width_n
, window_width
,
window_width_n_frac
, or window_width_frac