
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)
A vector.
Names for the new vector. Defaults to the names of
x
. This can be a function to apply to the names of x
as in
set_names()
.
Values to repeat.
new-vector
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab