


Like all our packages, namer is developed in the open on GitHub so you can go read what we’re planning for the future. Future plans for even more nifty automatic naming It allows you to select that file thanks to our very first Hacktoberfest contributor, Ellis Valentiner! Read more about Hacktoberfest at Locke Data here. Last but not least, we have a minimal RStudio addin shipped with the package, to name chunks of any R Markdown file. Namer ::unname_all_chunks( "reports/my-report.md")
#R markdown chunk options how to
Difference between two R Markdown reports before and after using namer to label chunks How to use namer? In each of the files in the dir “pres”, it labelled chunks using the filename and numbers. The screenshot below is a real-life example result of running namer::name_dir_chunks(“pres”). In practice, namer provides this service for a single document, or a whole folder at once, and an RStudio add-in for naming the chunks of the current active document. Voilà! Happy chibi Stef being told by R that there is an error in the chunk labelled test-12 Therefore, all chunks of “my-fantastic-report.Rmd” get named “my-fantastic-report-1”, “my-fantastic-report-2”.

Luckily, thanks to a brilliant idea of Steph’s, namer is now here to save your (vegan) bacon! This nifty package will name your chunks for you when you’ve (willingly or unwillingly) forgotten to do so! For any R Markdown document, namer creates and saves chunk labels based on the filename stripped from its extension. That’s what we say when teaching R Markdown, and what’s promoted in this blog post of mine featuring puppy photographs! But, sadly, we don’t always follow best practice, do we? What does namer do? One good piece of advice would be to always name your chunks.
#R markdown chunk options full
Or, since caches are named after chunks, if you delete one chunk in a document full of unnamed chunks, all your caches become useless. How do you find the culprit?! That name you get in the error message is not written in any file! Sad chibi Stef being told by R that there is an error in unnamed-chunk-12 But even when not informative, chunk labels are very important! Imagine you’re compiling a whole book, and oops, a bug appears in… unnamed-chunk-566. Informative names can help when navigating your files and will be used as informative filenames for figures generated in chunks. When writing R Markdown documents, be it a single report or a whole book based on dozens of documents, it’s crucial to name your R Markdown chunks.

More details in this post! Why name your R Markdown chunks? We’ve just released a sweet package to save you stress from the hassle of unnamed chunks in R Markdown! namer will name all your chunks, so you can quickly debug in future. Namer, Automatic Labelling of R Markdown Chunks
