vec_slice {vctrs} | R Documentation |
This provides a common interface to extracting and modifying observations
for all vector types, regardless of dimensionality. It is an analog to [
that matches vec_size()
instead of length()
.
vec_slice(x, i) vec_slice(x, i) <- value
x |
A vector |
i |
An integer or character vector specifying the positions or names of the observations to get/set. |
value |
Replacement values. |
x <- sample(10) x vec_slice(x, 1:3) vec_slice(x, 2L) <- 100 x vec_slice(mtcars, 1:3)