Reproducibility using R

/ [lectures]   / #rmarkdown #data science #reproducibility 

Beyond the availability of data and methods, reproducible science requires the traceability of analyses. Whether it is for yourself or for collaborators, as series of tools and good practices can facilitate your work flow, simplify analyses, and prevent the loss of data and results. This lecture provides an introduction to reproducibility using R.


Click on the image below to access the slides:

click there for slides

Related packages


knitr provides excellent resources for literate programming mixing R with LaTeX or markdown.

It is extensively documented at:

To install the current stable, CRAN version of the package, type:


To benefit from the latest features and bug fixes, install the development version of the package using:

update.packages(ask = FALSE, repos = '')
install.packages('knitr', repos = c('', ''))


rmarkdown extends the capabilities of knitr with a more diverse set of outputs generated from Rmd files, including pdf documents, article templates, pdf or html slides, or even web applications.

More information on rmarkdown is available from:

To install this package, type:


For the devel version, type (uses devtools):



lintr will analyse your code and point out deviations from current good coding practices. It can be ran on a .R file, but also can be used to analyse code typed in real-time for a number of coding platforms including Rstudio, emacs and others.

For more information on this package, go to:

To install this package, type:



The reportfactory provides an infrastructure for handling multiple Rmd reports which need regular updating.

For more information on this package, go to:

To install this package, type:


Other resources

Golden rules for writing analysis reports

These golden rules list several coding and statistical practices aimed at improving readability and robustness of analysis reports. Click on this link to download the current version, or visit this page for more information.

Report factory templates

This repository provides templates of report factories based on existing factories. Visit the github project for more information.

R4epi templates

The R4epi project provides several templates for epidemiological data analysis. Visit their website for more information.

About this document


  • Thibaut Jombart: initial version

Contributions are welcome via pull requests. The source files include:

License: CC-BY Copyright: Thibaut Jombart, 2017