Writing beautiful and reproducible slides quickly

Yihui Xie

2012/04/30

Why

A bit R code

head(cars)
##   speed dist
## 1     4    2
## 2     4   10
## 3     7    4
## 4     7   22
## 5     8   16
## 6     9   10
cor(cars)
##        speed   dist
## speed 1.0000 0.8069
## dist  0.8069 1.0000

Graphics too

library(ggplot2)
qplot(speed, dist, data = cars) + geom_smooth()
A scatterplot of cars
A scatterplot of cars

How

For ninjas

For beamer lovers

For Powerpoint lovers

Reproducible research

It is good to include the session info, e.g. this document is produced with knitr version 0.5.1. Here is my session info:

print(sessionInfo(), locale = FALSE)
## R version 2.15.0 (2012-03-30)
## Platform: x86_64-pc-linux-gnu (64-bit)
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] ggplot2_0.9.0 knitr_0.5.1  
## 
## loaded via a namespace (and not attached):
##  [1] codetools_0.2-8    colorspace_1.1-1   dichromat_1.2-4   
##  [4] digest_0.5.2       evaluate_0.4.2     formatR_0.4.1     
##  [7] grid_2.15.0        highlight_0.3.1    MASS_7.3-17       
## [10] memoise_0.1        munsell_0.3        parser_0.0-14     
## [13] plyr_1.7.1         proto_0.3-9.2      RColorBrewer_1.0-5
## [16] Rcpp_0.9.10        RCurl_1.91-1       reshape2_1.2.1    
## [19] scales_0.2.0       stringr_0.6        tools_2.15.0      
## [22] XML_3.6-2         

Life is short