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.

Slides

Click on the image below to access the slides:

click there for slides

Related packages

knitr

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

It is extensively documented at: https://yihui.name/knitr/

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

install.packages("knitr")

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

update.packages(ask = FALSE, repos = 'https://cran.rstudio.org')
install.packages('knitr', repos = c('https://xran.yihui.name', 'https://cran.rstudio.org'))

rmarkdown

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: http://rmarkdown.rstudio.com/.

To install this package, type:

install.packages("rmarkdown")

For the devel version, type (uses devtools):

devtools::install_github("rstudio/rmarkdown")

lintr

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: https://github.com/jimhester/lintr.

To install this package, type:

install.packages("lintr")

reportfactory

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

For more information on this package, go to: https://github.com/reconhub/reportfactory.

To install this package, type:

remotes::install_github("reconhub/reportfactory")

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

Contributors

  • Thibaut Jombart: initial version

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

License: CC-BY Copyright: Thibaut Jombart, 2017