Sweave and Reproducible Research, Nov 1st 2011.


Reproducible Research

  • Importance of Reproducdible Research
  • Why should we perform reproducible research
  • A survey of reproducibility, cases studies
  • Using Sweave

Instructor information

Aedin Culhane contact: aedin@jimmy.harvard.edu

Lectures Notes and Manual

Slides Reproducible Research

Manual on producing documents using Sweave and creating Bioconductor packages

  • List of R packages that are useful for Reproducible Research (from CRAN task views)
  • R2HTML Results of Demo


    Useful within text

    Add R code within text

    The number of rows in matrix is N= \Sexpr{nrow(myMatrix)}
    

    The number of rows in matrix is N= 10
    

    Exercise Data Files

    Download this Sweave style file and place it in your current working directory Sweave.sty

    Load Example Sweave File (rnw file.edit this one) exampleSweave.rnw. use commands

    Sweave(file="exampleSweave.Rnw")
    tools::texi2dvi(file="exampleSweave.tex", pdf=TRUE)
    Stangle(file="exampleSweave.Rnw")
    

    which will build the tex file, convert the tex file to pdf, and extract the R code chunks respectively,

    • Results of Sweave("exampleSweave.rnw") on Example Sweave File (tex file.. do not edit) exampleSweave.tex
    • Results of tools::texi2dvi("exampleSweave.tex", pdf=TRUE) on tex file exampleSweave.pdf
    • Results of Stangle("exampleSweave.rnw") on Example Sweave File exampleSweave.R

    Embedding R code into other document types

    HTML Document Office Documents
    • You can also use odfWeave to weave R code in OpenOffice documents. There is a nice tutorial on using odfweave available from Graham Williams in his book DATA MINING Desktop Survival Guide which is available online
    • R code can be embedded in Excel documents using Statconn. I haven't tried this but it looks promising. They have a long (30 min) demo online
    • Embedding R code in MSoffice document, spreadsheets (Excel) and presentations (powerpoint) using Inference for R . This is commerical software, but they offer a 1 year academic licence for free if you register with them. A commerical adverstisting Inference for R