Calculates coefficient of variation using static or sliding methods, with potential for custom methods as well
cv_2rm(
x,
window_size = 10,
approach = c("sliding", "static", "custom"),
verbose = FALSE,
...
)static_cv(x, window_size)
sliding_cv(x, window_size)
custom_cv(x, window_size, pad_size = window_size - 1, ...)
a numeric vector of values, giving the desired coefficient of variation
a numeric vector on which to perform the calculation
width of the sliding window, in data points
character scalar naming the desired calculation approach to
use. Can be "sliding" (the default; see Crouter et al., 2010),
"static" (see Crouter et al., 2006), or "custom" (see details
below)
logical. Print progress updates?
arguments passed to functions in the RcppRoll package
The number of NA values to append at the start and end of
x (when approach == "custom") before executing the rolling
minimum step.
For approach == "sliding", the value for each epoch
represents the lowest CV value of all the sliding windows that overlap with
that epoch. For aproach == "static", a truncated vector of CV values
is given, which reflects CV values from a non-overlapping sliding window.
For approach == "custom", users can pass arguments into
RcppRoll functions and create a variation on the sliding approach.
Behavior of this feature is not well documented and subject to change if
people start using it and requesting specific behavior.
data(raw_for_cv)
cv_2rm(raw_for_cv$ENMO)
Run the code above in your browser using DataLab