When a value from an inline R expression is a character vector of multiple
elements, we may want to combine them into a phrase like a and b, or
a, b, and c. That is what this a helper function does.
combine_words(words, sep = ", ", and = " and ", before = "", after = before)
A character vector.
Separator to be inserted between words.
Character string to be prepended to the last word.
A character string to be added before/after each word.
If the length of the input
words is smaller than or equal to 1,
words is returned. When
words is of length 2, the first word
and second word are combined using the
and string. When the length is
greater than 2,
sep is used to separate all words, and the
string is prepended to the last word.
A character string.
1 2 3 4 5 6
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.