max_run | R Documentation |
min_run
calculates running max on given x
numeric vector,
specified k
window size.
max_run(
x,
k = integer(0),
lag = integer(1),
idx = integer(0),
at = integer(0),
na_rm = TRUE,
na_pad = FALSE
)
x |
( |
k |
( |
lag |
( |
idx |
( |
at |
( |
na_rm |
|
na_pad |
( |
max (numeric
) vector of length equals length of x
.
set.seed(11)
x1 <- sample(c(1, 2, 3), 15, replace = TRUE)
x2 <- sample(c(NA, 1, 2, 3), 15, replace = TRUE)
k <- sample(1:4, 15, replace = TRUE)
max_run(x1) # simple cumulative maximum
max_run(x2, na_rm = TRUE) # cumulative maximum with removing NA.
max_run(x2, na_rm = TRUE, k = 4) # maximum in 4-element window
max_run(x2, na_rm = FALSE, k = k) # maximum in varying k window size
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.