When using rmarkdown
it is frequently the case that you want to programmatically generate fragments of text, in particular to list items being used. For example;
The species of iris examined were `r cat(as.character(unique(iris$Species)), sep = ", ")`.
Which would produce
The species of iris examined were setosa, versicolor, virginica.
To read properly it should be
The species of iris examined were setosa, versicolor, and virginica.
Is there a simple way to do this?