ABSTRACT

We can write documents for knitr with any text editor, because these documents are plain text files. For example, lightweight editors like Notepad under Windows or Gedit under Linux will work. RStudio is a relatively new editor specially targeted at R. It may be the best editor to start with for a beginner, since it has the most comprehensive support to Sweave and knitr. ESS (Emacs Speaks Statistics) is an add-on package for the text editor Emacs. ESS is also free and open-source software. After it has been installed along with Emacs, it is fairly easy to call knitr in Emacs. The default option for Rnw documents is Sweave, and we can change it to knitr with the following commands: M-x customize-group ess-R Find the ess-swv-processor option and change it to knitr. Then we can create a new Rnw document, press M-n s to compile Rnw to , and M-n P to compile to PDF.