prepend

0th

Percentile

Prepend a vector

This is a companion to base::append() to help merging two lists or atomic vectors. prepend() is a clearer semantic signal than c() that a vector is to be merged at the beginning of another, especially in a pipe chain.

Usage
prepend(x, values, before = 1)
Arguments
x

the vector to be modified.

values

to be included in the modified vector.

before

a subscript, before which the values are to be appended.

Value

A merged vector.

Aliases
  • prepend
Examples
# NOT RUN {
x <- as.list(1:3)

append(x, "a")
prepend(x, "a")
prepend(x, list("a", "b"), before = 3)
# }
Documentation reproduced from package rlang, version 0.1.6, License: GPL-3

Community examples

Looks like there are no examples yet.