litr: Write an R Package Entirely with an R Markdown Document

Yihui Xie 2023-01-04

A few months ago I came across a package named litr, which seemed quite interesting to me. It allows you to create a whole R package by rendering a single R Markdown document. That means you get a package after you click the Knit button in RStudio. I was interested because I had a similar idea and a proof-of-concept (i.e., the rlp package) in 2014, which was also mentioned in the documentation of litr. I’m happy that the authors of litr have taken a further step to make a solid implementation!

I saw the talk announcement of Jacob Bien (the main author of litr) in October last year in the statistical graphics group at Iowa State, marked it on my calendar, but missed it unfortunately on that day. Jacob didn’t know that I was still lurking in the group (I was still subscribed to their mailing list), and kindly emailed me later about this package, together with the slides of his talk.

I have said enough about the advantages of this approach on the rlp page, so I’m not repeating here. If you intend to document/explain your code extensively when writing a package, you may give litr a try.

P.S. While reading litr’s documentation, I discovered a person named Matt Pharr since Jacob mentioned the Academy award. I’ve never heard of him before, but it’s funny to know that we had similar sentiments about Twitter in 2017 (his post, mine, and mine).

P.P.S. I remember there was another R package that did the similar thing but my google search failed me. Later I learned that it was fusen: https://thinkr-open.github.io/fusen/ (nice job, Sébastien Rochette!)