One Little Thing: knitr::combine_words()

1 · Yihui Xie · June 18, 2018, midnight
When you want to output a character vector for humans to read, you probably don’t want something like [1] a b c, which is the normal way to print a vector in R. Instead, you may want a character string "a, b, and c" (Oxford comma FTW!). In 2014, I gave a guest lecture in a course at Iowa State. I prepared an example in which I wanted to output the names of some genes dynamically with an inline R expression in a knitr document. In the beginning, I didn’t want to spend too much time on this task, ...