Writing papers in Rmarkdown

Rmarkdown is a great tool for reproducible science. You can combine text and code to produce dynamic reports that generate updated results with a single click, as in the example below. The Rmarkdown document in the left produces a pdf document (right) that integrates text with code output. It is thus much easier to trace how results derive from a particular dataset and keep them always updated, also minimising errors.

Some time ago I put together an R package ( rmdTemplates) containing a few templates to write scientific articles and manuscript reviews (among other things). The point of having such a package is that it’s much easier to create new Rmarkdown documents ready for production (particularly using Rstudio). We only need to choose which particular template we want to use:

For example, if we choose the ‘ms_pdf’ template (modified from a very nice template by Jeff Hollister) we will get an Rmarkdown document with all the necessary scaffolding (citations, tables, figures, equations, line numbers…) to produce manuscripts ready for submission to a journal (as the example below). We just need to fill it with content, of course.

The package is freely available on GitHub. You can easily install it and give it a try. If you like the feeling of it, check out also new packages like rticles and bookdown, and explore all the content available at http://rmarkdown.rstudio.com.

Francisco Rodríguez-Sánchez
Francisco Rodríguez-Sánchez
Researcher

Computational Ecologist & Data Scientist.

Related