The latest version of ESS now includes support for knitr
. This script is no longer necessary.
During my recent switch from vim to Emacs I discovered what a wonderful tool ESS is. It was fantastic for writing Rnw
documents using Sweave
, but seeing as I’m currently attempting another switch, from Sweave
to knitr
, I wanted support for that.
After a quick look at the ESS source code, I was able to write a quick script that gives ESS support for knitr
.
Installation
- Download the Emacs lisp script below.
- Store it in a useful location, I stored it in the following path:
~/.emacs.d/ess-knitr/ess-knitr.el
- Import the script in your
.emacs
file. My configuration is the following:
;; Add support for knit and purl
(add-to-list 'load-path "~/.emacs.d/ess-knitr/")
(require 'ess-knitr)
Note: This snippet should be included after the code that loads ESS.
Usage
M-n r
“knit” anRnw
document.M-n u
“purl” anRnw
document.