powered by
Calculates moving averages or maximum moving average. For optimal speed, use integer = TRUE if x is an integer vector and integer = FALSE otherwise.
integer = TRUE
x
integer = FALSE
moving_mean(x, window, integer = FALSE, max = FALSE)
Integer or numeric vector.
Integer value specifying window length.
Logical value for whether x is an integer vector.
Logical value for whether to return maximum moving average (as opposed to vector of moving averages).
Numeric value or vector depending on max.
max
# NOT RUN { # 5-unit moving average for integer vector of length 10 x <- rpois(10, lambda = 3) moving_mean(x, 5) # }
Run the code above in your browser using DataLab