Category Archives: Emacs

Slides and blog posts with R and emacs org-mode

Preparing a larger number of slides with R code and plots can be a bit tedious with standard desktop presentation software like powerpoint or keynote. The manual effort to change the example code, run the analysis and then cut and paste updated graphs, tables and code is high. Sooner or later one is bound to create inconsistencies between code and expected results or even syntax errors

Using emacs and its swiss army knife org-mode there is another elegant and reproducible solution: just export the consistent code and output from an org-mode code block to generate either slides or bog pages (or both) from a single source. As a free benefit freen this tool chain can also produce high quality PDF handouts with a managed table of content and an index.

Org Mode source blocks

Here is a standard statistics “hello world” example using ggplot2:


df <- data.frame( norm = rnorm(10000))
ggplot(df, aes(x = norm)) + geom_histogram()


Continue reading