% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/character.r
\name{collapse}
\alias{collapse}
\alias{collapse0}
\alias{listing}
\title{Collapse a Vector of Strings into a Single String}
\usage{
collapse(..., sep = "", recurse = FALSE)

collapse0(..., sep = "", recurse = FALSE)

listing(x, sep = ", ", conjunction = "and", period = TRUE, quote = NULL)
}
\arguments{
\item{...}{one or more \strong{R} objects, to be converted to \link{character} vectors.}

\item{sep}{character string to collapse the terms, not \code{\link{NA_character_}}.}

\item{recurse}{\code{\link{logical}}. If \code{TRUE}, collapse each argument separately
first, before collapsing the results into a single string.}

\item{x}{a character vector from which to create the human readable list.}

\item{conjunction}{character string to use as a conjunction for the
last two terms.}

\item{period}{\code{\link{logical}}. If \code{TRUE}, append a period to the end of the
string.}

\item{quote}{\code{\link{NULL}} or a character string indicating the type of quotes
to use for quoting the terms. If \code{NULL}, no quoting is done. If \code{"single"},
single quotes are used, if \code{"double"}, double quotes are used, and if
\code{"back"}, backquotes are used.}
}
\value{
a single character string.
}
\description{
Collapse a character vector into a single string, with an optional
separator, and for \code{listing()} an optional conjunction and period,
with options to quote the terms.
}
\details{
\code{collapse} and \code{collapse0} are simple wrappers for
\code{paste0(..., collapse = sep)} and \code{paste(..., collapse = sep)}, with
an option to collapse each argument separately first, before collapsing
the results.
}
\examples{
collapse(c("a", "b", "c"), "d")
collapse0(c("a", "b", "c"), "d")

collapse(c("a", "b", "c"), "d", sep = ", ")
collapse0(c("a", "b", "c"), "d", sep = ", ")

collapse(c("a", "b"), c("c", "d"), sep = ", ")
collapse(c("a", "b"), c("c", "d"), sep = ", ", recurse = TRUE)

listing(c("a", "b", "c"), sep = ", ", conjunction = "and")
listing(c("a", "b"), conjunction = "or", period = FALSE)

listing(c("a", "b", "c"), quote = "single")
listing(c("a", "b", "c"), quote = "double")
listing(c("a", "b", "c"), quote = "back")
}
\seealso{
\link{paste0}, \link{sQuote}, \link{dQuote}, \link{bckQuote}.
}
