knitr::combine_words(c("banana", "apple", "orange"))banana, apple, and orange
Oxford commas are optional
Nick Twort
16 Aug 2023
If you’ve got a vector of words that you want to combine with a different separator for the last pair of words (eg, you want to use ‘and’), just use knitr::combine_words()
For example:
You can even ask for no Oxford comma: