Learn R Programming

concatenate (version 1.0.0)

cc: Comma Concatenation

Description

cc collapses text into a comma-separated list (the colloquial kind of list). cc_or and cc_and insert "or" and "or" before the last element.

Usage

cc(...)
"cc"(...)
cc_or(..., oxford = FALSE)
cc_and(..., oxford = FALSE)

Arguments

...
Character vectors or a data.frame.
oxford
Whether to use the Oxford comma.

Value

A length-one character vector in which each element in ... is separated by a comma (and a space).

Details

The data.frame method is dispatched when the first argument in ... is a data.frame. It operates row-wise. If there are subsequent arguments to cc they are be ignored.

See Also

cn for cc with (grammatical) number awareness (like ngettext) and substitution (like sprintf)

Examples

Run this code
cc("hello", "world")

a <- "one thing"
b <- "another"
cc_or(a, b)

a <- "this"
b <- c("that", "the other")
cc_and(a, b)

Run the code above in your browser using DataLab