R Tips

Add "and" at the end of character vector

Imagine you’re writing in an Rmarkdown document and you need to list a series of items in your text. Also, the elements you want to include in your text are stored in a vector, say cvec, so you just need to include the vector as part of the text in your rmarkdown document. However, you realize that the last item is not separated by an “and” in the text, so your text does not read well.