along

0th

Percentile

Helper to create vectors with matching length.

These functions take the idea of seq_along and generalise it to creating lists (lst_along) and repeating values (rep_along). The dots and .attrs are forwarded to with_attributes() to make it easy to add attributes. Except for lst_along() and raw_along(), the empty vectors are filled with typed missing values.

Usage
lgl_along(.x, ..., .attrs = list())
int_along(.x, ..., .attrs = list())
dbl_along(.x, ..., .attrs = list())
chr_along(.x, ..., .attrs = list())
lst_along(.x, ..., .attrs = list())
cpl_along(.x, ..., .attrs = list())
raw_along(.x, ..., .attrs = list())
rep_along(.x, .y, ..., .attrs = list())
Arguments
.x
A vector.
...
A list of named attributes.
.attrs
A list of named attributes.
.y
Values to repeat.
See Also

new-vectors

Aliases
  • along
  • lgl_along
  • int_along
  • dbl_along
  • chr_along
  • lst_along
  • cpl_along
  • raw_along
  • rep_along
Examples
x <- 0:5
rep_along(x, 1:2)
rep_along(x, 1)
lst_along(x)

# You can also add attributes with additional arguments:
rep_along(x, 1, class = "my_class")
dbl_along(x, class = "my_class")
Documentation reproduced from package rlang, version 0.0.0.9000, License: GPL-3

Community examples

Looks like there are no examples yet.