cc: Comma Concatenation

Description Usage Arguments Details Value See Also Examples

View source: R/cc.r

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

1
2
3
4
5
6
7
8
cc(...)

## S4 method for signature 'data.frame'
cc(...)

cc_or(..., oxford = FALSE)

cc_and(..., oxford = FALSE)

Arguments

...

Character vectors or a data.frame.

oxford

Whether to use the Oxford comma.

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.

Value

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

See Also

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

Examples

1
2
3
4
5
6
7
8
9
cc("hello", "world")

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

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

Example output

[1] "hello, world"
[1] "one thing or another"
[1] "this, that and the other"

concatenate documentation built on May 1, 2019, 8:05 p.m.