ReproducibleResearch

Reproducible Research

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 conversions 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.

View on CRAN

02 years ago

Max Kuhn

Packages

38
49
74
77
185
197
214
262
293
394
400
468
519
610
650
651
671
697
737
806
897
975
1191
1309
1312
1324
1368
1474
1575
1657
1714
1989
2145
2208
2264
2309
2512
2593
2719
2973
3029
4170
4841
5053
5339
6406
7399
9312
10259
10298
10374
11109

Discussions