new-vector-along

0th

Percentile

Create vectors matching the length of a given vector

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.

Usage
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)

Arguments
x, .x

A vector.

names

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().

.y

Values to repeat.

See Also

new-vector

Aliases
  • new-vector-along
  • new_logical_along
  • new_integer_along
  • new_double_along
  • new_character_along
  • new_complex_along
  • new_raw_along
  • new_list_along
  • rep_along
Examples
library(rlang) # 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) # }
Documentation reproduced from package rlang, version 0.2.0, License: GPL-3

Community examples

Looks like there are no examples yet.