2.6 Rmarkdown

Rmarkdown is a simple markup language that embeds R code and its output in order to produce a large variety of document types as output, including HTML or PDF (see Figure 2.4).

Artwork by allison_horst

Figure 2.4: Artwork by allison_horst

A strong argument for using something like Rmarkdown in your research pipeline in reproducibility (see Figure 2.5). When you prepare a data set and perform a statistical analysis, for example, you will by necessity make a lot of detailed decisions, not all of which are easy to report in natural language, but all of which combined, contribute to the results you eventually report, e.g., in a research or term paper. Since science aims for objectivity and social structures of scrutinizing previous results, it is important to share with other researchers all of your assumptions and decisions of detail. Ideally, therefore, you can share something like a nicely commented Rmarkdown file that contains every step of the analysis.

Artwork by allison_horst

Figure 2.5: Artwork by allison_horst

To get familiar with Rmarkdown, please follow this tutorial.