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.eduLectures Notes and Manual
Slides Reproducible Research
Manual on producing documents using Sweave and creating Bioconductor packages
- pdf file Workshop-reproducible-research.pdf
- R code Workshop-reproducible-research.R
- Swave rnw file - Workshop-reproducible-research.Rnw
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- Sweave can produce html output. Just edit a basic html template document
and then use the html Sweave driver:
Sweave("filename.rnw", driver=RweaveHTML)
- 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
- Creating tables and Figures using Sweave
- More on making tables
- A template rnw file (from Keith Baggerly) template.rnw
- Converting Latex to Word
- Keith Baggerly's resources
- TeX User Group (TUG) Website. If you get more involved in TeX, who may wish to attend the TUG annual meeting which will be held in Boston in July 16-18 2012
- Using Lyx graphical user interface to latex
- Converting Sweave to other formats, including doc and html
- R Software: Download R from from the R home page and if you wish, the integrated development envirnoment (IDE) R Studio which is available for Windows, Mac or Linux OS
- Windows software: Download MikTex and an editor such as TexWorks, TeXnicCenter or simply just use an enchanced notepad like Notepad++
- Windows: There is also a easy-to-install Tex software bundle called proTeXt which includes MikTex, TeXnicCenter and Ghostscript
- MacOS software: Download MaxTEx and TeXshop for editing
- Linux: I tend to use either Kate (within KDE), Emacs or Texworks which is cross platform
- More on Latex Editors from Wikipedia
- Convert Tex to a MSword Document using TeX4ht
- Introduction to R Lecture notes from Bio503 Programming and Statistical Modeling in R (Jan 2011)
- Experimental Design Experimental design (slides)
- Dupuy A & Simon RM (2007) Critical Review of Published Microarray Studies for Cancer Outcome and Guidelines on Statistical Analysis and Reporting JNCI 99:147-57 Simon's review in JNCI
- Ioannidis JP, Allison DB, Ball CA, Coulibaly I, Cui X, Culhane AC, Falchi M, Furlanello C, Game L, Jurman G, Mangion J, Mehta T, Nitzberg M, Page GP, Petretto E, van Noort V. (2009) Repeatability of published microarray gene expression analyses. Nat Genet. 41(2):149-155. Paper and accompanying Editorial