https://github.com/cran/purrr
Revision 452ab595ffca898f49b97e675df9da72b068fa43 authored by Hadley Wickham on 04 January 2016, 22:04:10 UTC, committed by cran-robot on 04 January 2016, 22:04:10 UTC
1 parent 1d72879
Raw File
Tip revision: 452ab595ffca898f49b97e675df9da72b068fa43 authored by Hadley Wickham on 04 January 2016, 22:04:10 UTC
version 0.2.0
Tip revision: 452ab59
prepend.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/objects.R
\name{prepend}
\alias{prepend}
\title{Prepend a vector}
\usage{
prepend(x, values, before = 1)
}
\arguments{
\item{x}{the vector to be modified.}

\item{values}{to be included in the modified vector.}

\item{before}{a subscript, before which the values are to be appended.}
}
\value{
A merged vector.
}
\description{
This is a companion to \code{\link{append}()} to help merging two
lists or atomic vectors. \code{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.
}
\examples{
x <- as.list(1:3)

x \%>\% append("a")
x \%>\% prepend("a")
x \%>\% prepend(list("a", "b"), before = 3)
}

back to top