View source: R/metR_small_funs.R
| JumpBy | R Documentation |
Skip observations
JumpBy(x, by, start = 1, fill = NULL)
x |
vector |
by |
numeric interval between elements to keep |
start |
index to start from |
fill |
how observations are skipped |
Mostly useful for labelling only every byth element.
A vector of the same class as x and, if fill is not null,
the same length.
Other utilities:
Anomaly(),
Mag(),
Percentile(),
logic
x <- 1:50
JumpBy(x, 2) # only odd numbers
JumpBy(x, 2, start = 2) # only even numbers
JumpBy(x, 2, fill = NA) # even numbers replaced by NA
JumpBy(x, 2, fill = 6) # even numbers replaced by 6
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.