Task view: Reproducible Research

Last updated on 2015-12-03 by Max Kuhn

The goal of reproducible research is to tie specific instructions to data analysis and experimental data so that scholarship can be recreated, better understood and verified. Packages in R for this purpose can be split into groups for: literate programming, package reproducibility, code/data formatting tools, format convertors, and object caching.

Literate Programming

The primary way that R facilitates reproducible research is using a document that is a combination of content and data analysis code. The Sweave function (in the base R utils package) and the knitr package can be used to blend the subject matter and R code so that a single document defines the content and the analysis. The brew and R.rsp packages contain alternative approaches to embedding R code into various markups.

The resources for literate programming are best organized by the document type/markup language:

LaTeX

Both Sweave and knitr can process LaTeX files. lazyWeave can create LaTeX documents from scratch.

Object Conversion Functions:

Miscellaneous Tools

  • Hmisc contains a function to correctly escape special characters. resumer creates resumes. Standardized exams can be created using the exams package.

HTML

The knitr package can process HTML files directly. Sweave can also work with HTML by way of the R2HTML package. Kmisc and lazyWeave can create HTML format documents from scratch.

Object Conversion Functions:

Miscellaneous Tools: htmltools has various tools for working with HTML. tufterhandout for creating Tufte-style handouts

Markdown

The knitr package can process markdown files without assistance. The packages markdown and rmarkdown have general tools for working with documents in this format. Kmisc and lazyWeave can create markdown format documents from scratch. Also, the ascii package can write R objects to the AsciiDoc format.

Object Conversion Functions:

Miscellaneous Tools: tufterhandout for creating Tufte-style handouts. kfigr allows for figure indexing in markdown documents.

OpenDocument Format (ODF)

The odfWeave package can process ODF files.

Object Conversion Functions:

Microsoft Formats

The ReporteRs (formerly R2DOCX) package can create docx and pptx files. R2wd (windows only) can also create Word documents from scratch and R2PPT (also windows only) can create PowerPoint slides. The rtf package does the same for Rich Text Format documents.

Object Conversion Functions:

Miscellaneous Tools

Package Reproducibility

R also has tools for ensuring that specific packages versions can be required for analyses. checkpoint, rbundler and packrat install packages required for a project to a local archive as they existed at a specified point in time. This allows specific package versions to be maintained over time and different users. The miniCRAN package facilitates the creation of local CRAN-like repositories.

Formatting Tools

formatR, highlight, highr, and SweaveListingUtils can be used to color and/or format R code.

Packages humanFormat, lubridate, prettyunits, and rprintf have functions to better format data.

Format Convertors

pander can be used for rendering R objects into Pandoc's markdown. knitr has the function pandoc that can call an installed version of Pandoc to convert documents between formats such as Markdown, HTML, LaTeX, PDF and Word. tth facilitates TeX to HTML/MathML conversions. LaTeX to Rich Text Format converions can be done using the connect3 package.

Object Caching Packages

When using Sweave and knitr it can be advantageous to cache the results of time consuming code chunks if the document will be re-processed (i.e. during debugging). knitr facilitates object caching and the Bioconductor package weaver can be used with Sweave.

Non-literate programming packages to facilitating caching/archiving are R.cache and archivist.

Packages

animation — 2.5

A Gallery of Animations in Statistics and Utilities to Create Animations

apaStyle — 0.5

Generate APA Tables for MS Word

apsrtable — 0.8-8

apsrtable model-output formatter for social science

archivist — 2.1.2

Tools for Storing, Restoring and Searching for R Objects

ascii — 2.1

Export R objects to several markup languages

bibtex — 0.4.0

bibtex parser

brew — 1.0-6

Templating Framework for Report Generation

checkpoint — 0.4.1

Install Packages from Snapshots on the Checkpoint Server for Reproducibility

compareGroups — 3.2.4

Descriptive Analysis by Groups

connect3 — 0.1.0

A Tool for Reproducible Research by Converting 'LaTeX' Files Generated by R Sweave to Rich Text Format Files

DT — 0.2

A Wrapper of the JavaScript Library 'DataTables'

exams — 2.2-1

Automatic Generation of Exams in R

formatR — 1.5

Format R Code Automatically

formattable — 0.2.0.1

Create 'Formattable' Data Structures

highlight — 0.4.7.1

Syntax Highlighter

highr — 0.6

Syntax Highlighting for R Source Code

htmlTable — 1.9

Advanced Tables for Markdown/HTML

htmltools — 0.3.6

Tools for HTML

HTMLUtils — 0.1.7

Facilitates Automated HTML Report Creation

humanFormat — 1.0

Human-friendly formatting functions

hwriter — 1.3.2

HTML Writer - Outputs R objects in HTML format

Hmisc — 4.0-3

Harrell Miscellaneous

latex2exp — 0.4.0

Use LaTeX Expressions in Plots

lazyWeave — 3.0.1

LaTeX Wrappers for R Users

lubridate — 1.6.0

Make Dealing with Dates a Little Easier

kfigr — 1.2

Integrated Code Chunk Anchoring and Referencing for R Markdown Documents

Kmisc — 0.5.0

Kevin Miscellaneous

knitcitations — 1.0.7

Citations for 'Knitr' Markdown Files

knitLatex — 0.9.0

'Knitr' Helpers - Mostly Tables

knitr — 1.16

A General-Purpose Package for Dynamic Report Generation in R

markdown — 0.8

'Markdown' Rendering for R

memisc — 0.99.8

Tools for Management of Survey Data and the Presentation of Analysis Results

miniCRAN — 0.2.7

Create a Mini Version of CRAN Containing Only Selected Packages

NMOF — 0.40-0

Numerical Methods and Optimization in Finance

odfWeave — 0.8.4

Sweave processing of Open Document Format (ODF) files

odfWeave.survey — 1.0

Support for odfWeave on the survey package

packrat — 0.4.8-1

A Dependency Management System for Projects and their R Package Dependencies

pander — 0.6.0

An R Pandoc Writer

papeR — 1.0-2

A Toolbox for Writing Pretty Papers and Reports

prettyunits — 1.0.2

Pretty, Human Readable Formatting of Quantities

quantreg — 5.33

Quantile Regression

R.cache — 0.12.0

Fast and Light-Weight Caching (Memoization) of Objects and Results to Speed Up Computations

R.rsp — 0.41.0

Dynamic Generation of Scientific Reports

R2HTML — 2.3.2

HTML Exportation for R Objects

r2lh — 0.7

R to LaTeX and HTML

R2PPT — 2.1

Simple R Interface to Microsoft PowerPoint using rcom or RDCOMClient.

R2wd — 1.5

Write MS-Word documents from R

rapport — 1.0

A Report Templating System

rbundler — 0.3.7

Rbundler manages an application's dependencies systematically and repeatedly.

RefManageR — 0.13.1

Straightforward 'BibTeX' and 'BibLaTeX' Bibliography Management

reporttools — 1.1.2

Generate LaTeX Tables of Descriptive Statistics

ReporteRs — 0.8.8

Microsoft Word and PowerPoint Documents Generation

resumer — 0.0.3

Build Resumes with R

rmarkdown — 1.6

Dynamic Documents for R

rms — 5.1-1

Regression Modeling Strategies

rprintf — 0.2.1

Adaptive Builder for Formatted Strings

rtf — 0.4-11

Rich Text Format (RTF) Output

SortableHTMLTables — 0.1-3

Turns a data frame into an HTML file containing a sortable table.

sparktex — 0.1

Generate LaTeX sparklines in R

stargazer — 5.2

Well-Formatted Regression and Summary Statistics Tables

suRtex — 0.9

LaTeX descriptive statistic reporting for survey data

SweaveListingUtils — 0.7.7

Utilities for Sweave Together with TeX 'listings' Package

tables — 0.8

Formula-Driven Table Generation

TeachingSampling — 3.2.2

Selection of Samples and Parameter Estimation in Finite Population

texreg — 1.36.23

Conversion of R Regression Output to LaTeX or HTML Tables

tikzDevice — 0.10-1

R Graphics Output in LaTeX Format

tth — 4.3-2-1

TeX to HTML/MathML Translators tth/ttm

tufterhandout — 1.2.1

Tufte-style html document format for rmarkdown

xtable — 1.8-2

Export Tables to LaTeX or HTML

ztable — 0.1.5

Zebra-Striped Tables in LaTeX and HTML Formats


Task view list