Home Comments Thread
New Thread

litr: Write an R Package Entirely with an R Markdown Document | /en/2023/01/litr-package/

giscus giscus 2023-01-05 17:38:59

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

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 …

https://yihui.org/en/2023/01/litr-package/

1 Comment

statnmap statnmap 2023-01-05 17:39:00

Thank you, Yihui, for mentionning {fusen} which also follows this idea.
If users are interested in how to write a package with the "Rmd first" method, they can follow this full tutorial: https://statnmap.github.io/teach-package-dev-rmdfirst//stagiaire_complet.html#1
You'll learn what is a package and practice how to use {fusen} to build it from an Rmarkdown file (or a quarto file). Not only beginners, but also advanced R developers may find interest in this method of writing packages. You won't delay writing documentation and unit test anymore, and allow your work to be safely shared with the community as early as possible.
Moreover, {fusen} uses {attachment} and {usethis} to reduce the number of things to think about when writing packages. Just focus on your ideas and code, {fusen} will do the rest.

Note that following "nbdev" idea, I recently added the possibility to build the pkgdown website by reducing the number of actions to make it available for new projects (it mainly uses {usethis} of course, nothing new). I talk about it in this blog post: https://statnmap.com/2022-10-28-share-your-r-work-following-good-dev-practices-from-a-single-notebook/

👍 2
yihui yihui 2023-01-05 18:21:57

Thanks a lot for sharing these resources, Sébastien! I'm sure many people will find them helpful.

statnmap statnmap 2023-01-06 08:32:27

As you've been thinking about this "Rmd first" idea for a while, I'd be interested in your feedback on the use of {fusen} if you'd be willing too.
Indeed, you can use {fusen} with an existing package, this does not affect what is already there.
For instance, you could try it when you will write your next new function in one of your existing package. You just need to follow 7 small steps as documented here: https://thinkr-open.github.io/fusen/dev/articles/Maintain-packages-with-fusen.html#lets-try-to-convince-package-developers-with-an-example
Thank you

yihui yihui 2023-01-06 14:29:52

For the packages that I have written, I can't think of one package that is suitable for the "Rmd first" approach, i.e., I don't feel the need for explaining the code with Markdown. Anyway, thanks for the tips! I'll see if I'll have a chance in the future.

Sign in to join the discussion

Sign in with GitHub