Collapses a vector into a comma delimited string with the word 'and' between the last two entries.
collapse(
x,
sep = ", ",
maxItems = 10,
last = c("%1$s and %2$s", "%1$s, %2$s and %3$d more",
"%1$s, %2$s and %3$d more"),
quote = NULL
)a string
the vector
the separator for all but the last entry
If there are more than this many items, only the first maxItems are displayed.
three sprintf formats (see details)
A function used to quote the elements (such as sQuote or dQuote) or NULL
The last= argument contains three sprintf formats. The first is used if there are fewer than maxItems items, the second if there are maxItems+1 items, the first if there are more than maxItems+1 items.
The arguments are passed as the last, shown.