Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

The Question: Are there any good examples of reproducible research using R that are freely available online?

Ideal Example: Specifically, ideal examples would provide:

  • The raw data (and ideally meta data explaining the data),
  • All R code including data import, processing, analyses, and output generation,
  • Sweave or some other approach for linking the final output to the final document,
  • All in a format that is easily downloadable and compilable on a reader's computer.

Ideally, the example would be a journal article or a thesis where the emphasis is on an actual applied topic as opposed to a statistical teaching example.

Reasons for interest: I'm particularly interested in applied topics in journal articles and theses, because in these situations, several additional issues arise:

  • Issues arise related to data cleaning and processing
  • Issues arise related to managing metadata
  • Journals and theses often have style guide expectations regarding the appearance and formatting of tables and figures
  • Many journals and theses often have a wide range of analyses which raise issues regarding workflow (i.e., how to sequence analyses) and processing time (e.g., issues of caching analyses, etc.).

Seeing complete working examples could provide good instructional material for researchers starting out with reproducible research.

share|improve this question
add comment

14 Answers 14

Frank Harrell has been beating the drum on reproducible research and reports for many, many years. You could start at this wiki page which lists plenty of other resources, including published research and also covers Charles Geyer's page.

share|improve this answer
add comment

We wrote a paper explaining how to use R/Bioconductor when analysing microarray data. The paper was written in Sweave and all the code used to generate the graphs is included as supplementary material.

Gillespie, C. S., Lei, G., Boys, R. J., Greenall, A. J., Wilkinson, D. J., 2010. Analysing yeast time course microarray data using BioConductor: a case study using yeast2 Affymetrix arrays BMC Research Notes, 3:81.

share|improve this answer
add comment

Irreproducibility of NCI60 Predictors of Chemotherapy

This is a reproducible analysis showing the lack of reproducibility of a paper that has been in the news. A clinical trial based on the false conclusions of the irreproducible paper was suspended, re-instated, suspended again, ... It's a good example of reproducible analysis in the news.

share|improve this answer
add comment

Koenker and Zeileis provide a webpage with a relatively complete example. They share:

  • Rnw (Sweave code)
  • R analysis code
  • Final PDF
  • Discussion of version control issues
share|improve this answer
add comment

I have a few such examples on my research papers page. (I am not allowed to post more than one hyperlink as a new member. So I'll just describe the papers on that site.)

(1) "Making Effects Manifest in Randomized Experiments" uses R's vignette system.

(2) "Attributing Effects to a Cluster Randomized Get-Out-The-Vote Campaign" was a more complex paper involving some time consuming simulations. We used a Makefile based system and posted it to the Dataverse

(3) "EDA for HLM" was my earliest attempt. Here I just put the data and associated Sweave files in a tarball.

One problem we discovered when creating our JASA archive was that versions and defaults of CRAN packages changed. So, in that archive, we also include the versions of the packages that we used. The vignette based system will probably break as folks change their packages (not sure how to include extra packages within the package that is the Compendium).

Finally, I wonder about what to do when R itself changes. Are there ways to produce, say, a virtual machine that reproduces the entire computational environment used for a paper such that the virtual machine is not enormous?

Anyway, I hope that these examples help. At least they show some of my own experiments in this area.

(Here are some plain text hyperlinks.)

  [2]: http://jakebowers.org/manifesteffects-compendium-howto.txt
  [3]: http://hdl.handle.net/1902.1/12174
  [4]: http://hdl.handle.net/1902.1/13376
share|improve this answer
    
You raise some interesting questions. I've posted a separate question quoting you: stats.stackexchange.com/questions/4466/… –  Jeromy Anglim Nov 12 '10 at 1:06
add comment

The journal Biostatistics has an Associate Editor for Reproducibility, and all its articles are marked:

Reproducible Research

Our reproducible research policy is for papers in the journal to be kite-marked D if the data on which they are based are freely available, C if the authors’ code is freely available, and R if both data and code are available, and our Associate Editor for Reproducibility is able to use these to reproduce the results in the paper. Data and code are published electronically on the journal’s website as Supplementary Materials.

http://biostatistics.oxfordjournals.org/

How good an idea is that?

http://biostatistics.oxfordjournals.org/content/12/1/18.abstract comes with an R package in the supplementaries that does the analysis - haven't tried it myself yet. Also, can't find out where the openness rating is specified. Am emailing the associate editor with some questions...

[edit]

Roger Peng the associate editor tells me there probably is no way of finding the reproducible papers without getting the PDF. He pointed me at this one which has a nice big 'R' on it (which does not mean R-rated like movies) for reproducibility:

http://biostatistics.oxfordjournals.org/content/10/3/409.abstract

Of course the journal itself isn't free... #fail

Barry

share|improve this answer
1  
that's great to see a journal prioritising reproducibility. Have you seen any good examples of articles marked R? –  Jeromy Anglim Jul 28 '11 at 8:41
1  
They don't prioritise it for publication, I think they just want to highlight it. I'll edit my answer with an example. –  Spacedman Jul 28 '11 at 10:44
add comment

Charles Geyer's page on Sweave has an example from a thesis, which meets some of your requirements (the raw data is simply from an R package, but the R/sweave code and final PDF are available):

A paper on the theory in Yun Ju Sung's thesis, Monte Carlo Likelihood Inference for Missing Data Models (preprint) contained computing examples. Every number in the paper and every plot was taken (by cut-and-paste, I must admit) from a "supplementary materials" document done in Sweave.

(The source file is linked under the "Supplementary Materials for a Paper" section.)

I know I've come across at least one R example browsing the ReproducibleResearch.net material page before, but unfortunately didn't bookmark it.

share|improve this answer
    
These look like some good examples. Cheers. –  Jeromy Anglim Aug 21 '10 at 7:02
add comment

Simon Jackman has a particularly useful example of analysing the results of a survey: "Americans and Australians 10 years after 9/11". It has multiple examples of integrating tables and figures.

He has made the Sweave document and PDF report via this blog post.

While the raw data is not supplied (as far as I can tell), so it's not possible to run the actual Sweave examples, I think a fair bit can be learned from studying the Sweave code.

share|improve this answer
    
(+1) Thanks for the links. –  chl Jun 16 '11 at 20:45
add comment

Neil Saunders analysed online interactions associated with a conference. Several properties which make it a useful Sweave example include:

  • Rnw file is provided
  • Graphs are generated using ggplot
  • Good size and easily comprehensible domain

The materials are available here:

share|improve this answer
add comment

Also look at Journal Of Statistical Software; they encourage making papers in Sweave.

share|improve this answer
    
No, not formally -- LaTeX submission is encourages but if you look at the instructions page it does not contain the word Sweave. Authors do use it and/or ship the R code with the paper, but to me this echos Shane's point about package vignettes. –  Dirk Eddelbuettel Aug 21 '10 at 11:44
    
Ok, still most submitters do use it (also journal style includes Swave.sty); the main problem is that there are no Rnws published, still papers made by Sweave come with Stangle output. –  mbq Aug 21 '10 at 13:21
add comment

I have found good ones in the past and will post once I dig them up, but some quick general suggestions:

  1. You may be able to find some interesting examples by searching google with keywords and ext:rnw (which will search for files with the sweave extension). Here's an example search. This is the third result from my search: http://www.ne.su.se/paper/araietal_source.Rnw. Here's another example from my search: http://www.stat.umn.edu/geyer/gdor/.
  2. Many R packages have interesting vignettes which essentially amount to the same thing. An example: https://r-forge.r-project.org/scm/viewvc.php/paper/maxLik.Rnw
share|improve this answer
add comment

Robert Gentleman wrote a paper called "Reproducible Research: A Bioinformatics Case Study"

It implements a short set of analyses as an R Package and uses Sweave. It also discusses the use of Sweave more generally.

See the "Related Files" section of the article page for an archive file of all files and folders used.

Reference:

  • Gentleman, Robert (2005) "Reproducible Research: A Bioinformatics Case Study," Statistical Applications in Genetics and Molecular Biology: Vol. 4 : Iss. 1, Article 2.
  • DOI: 10.2202/1544-6115.1034
  • Available at: http://www.bepress.com/sagmb/vol4/iss1/art2
share|improve this answer
add comment

http://genome.cshlp.org/content/early/2011/06/09/gr.117523.110/suppl/DC1

A nice paper, by a lab mate of mine. Our PI was pretty pleased when something resembling fan mail came in for this. Now all publications from the group have the supplemental methods laid out in LaTeX/Sweave. Some of the papers, too (can't decide whether to keep mine in LyX/Sweave or fold and just do the supplementals in Sweave).

share|improve this answer
add comment

Looking for examples and practices is a good way to learn, but I just wanted to mention that reproducibility has not only technical/script rerun side, but also code style and structuring aspect, minimization of side effects in core functions etc. I personally found that Chambers book Software for Data Analysis allows to understand more deeply techniques that help to avoid reliability and reproducibility issues on R code level.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.