Convert the elements of a vector into character strings and paste them together, separated by commas.
commasep(x, join = " and ", flatten = TRUE)
A character string (if flatten=TRUE
, the default)
or a list of character strings.
Vector of items in the list.
The string to be used to separate the last two items in the list.
Logical value indicating whether to return a single character string
(flatten=TRUE
, the default) or a list (flatten=FALSE
).
Adrian Baddeley Adrian.Baddeley@curtin.edu.au.
commasep(letters[1:4])
y <- commasep(sQuote(letters[1:4]))
cat(y, fill=TRUE)
Run the code above in your browser using DataLab