\HeaderA{paste}{Concatenate Strings}{paste}
\keyword{character}{paste}
\begin{Description}\relax
Concatenate vectors after converting to character.
\end{Description}
\begin{Usage}
\begin{verbatim}
paste(..., sep = " ", collapse = NULL)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{...}] one or more \R{} objects, to be converted to character vectors.
\item[\code{sep}] a character string to separate the terms.
\item[\code{collapse}] an optional character string to separate the results.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{paste} converts its arguments (\emph{via}
\code{\LinkA{as.character}{as.character}}) to character strings, and
concatenates them (separating them by the string given by \code{sep}).
If the arguments are vectors, they are concatenated term-by-term to
give a character vector result.  Vector arguments are recycled as
needed, with zero-length arguments being recycled to \code{""}.

Note that \code{paste()} coerces \code{as.character(NA)} to \code{"NA"}
(a string with two characters rather than the \code{\LinkA{character}{character}}
missing value, \code{\LinkA{NA\_character\_}{NA.Rul.character.Rul.}}), which may seem
undesirable, e.g., when pasting two character vectors, but very
desirable in, e.g., \code{paste("the value of p is ", p)}.

If a value is specified for \code{collapse}, the values in the result
are then concatenated into a single string, with the elements being
separated by the value of \code{collapse}.
\end{Details}
\begin{Value}
A character vector of the concatenated values.  This will be of length
zero if all the objects are, unless \code{collapse} is non-NULL, in
which case it is a single empty string.
\end{Value}
\begin{References}\relax
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
\emph{The New S Language}.
Wadsworth \& Brooks/Cole.
\end{References}
\begin{SeeAlso}\relax
String manipulation with
\code{\LinkA{as.character}{as.character}}, \code{\LinkA{substr}{substr}}, \code{\LinkA{nchar}{nchar}},
\code{\LinkA{strsplit}{strsplit}}; further, \code{\LinkA{cat}{cat}} which concatenates and
writes to a file, and \code{\LinkA{sprintf}{sprintf}} for C like string
construction.

\sQuote{\LinkA{plotmath}{plotmath}} for the use of \code{paste} in plot annotation.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
paste(1:12) # same as as.character(1:12)
paste("A", 1:6, sep = "")
paste("Today is", date())
\end{ExampleCode}
\end{Examples}

