new-vector-along {rlang} | R Documentation |
These functions take the idea of seq_along()
and generalise it to
creating lists (new_list_along
) and repeating values (rep_along
).
Except for new_list_along()
and new_raw_along()
, the empty
vectors are filled with typed missing
values.
new_logical_along(x, names = base::names(x)) new_integer_along(x, names = base::names(x)) new_double_along(x, names = base::names(x)) new_character_along(x, names = base::names(x)) new_complex_along(x, names = base::names(x)) new_raw_along(x, names = base::names(x)) new_list_along(x, names = base::names(x)) rep_along(.x, .y)
x, .x |
A vector. |
names |
Names for the new vector. Defaults to the names of
|
.y |
Values to repeat. |
new-vector
x <- 0:5 rep_along(x, 1:2) rep_along(x, 1) new_list_along(x) # The default names are picked up from the input vector x <- c(a = "foo", b = "bar") new_character_along(x)