remacsessr-markdown

How can I use Emacs ESS mode with R markdown?


Is there a way to configure Emacs so that it recognizes (and allows execution of) R code chunks within R markdown (.Rmd) files similar to the way it recognizes code chunks in .Rnw (Sweave) or .org (org-mode) files?


Solution

  • The other answers are rather outdated, and polymode now provides a specialized package for working with .Rmd files. Simply use the poly-R package from MELPA which has its source here on Github.

    The following may be added to your init.el or where-ever you use use-package:

    (use-package poly-R
      :ensure t
      :pin melpa-stable)
    

    For a more detailed use-case involving modifying the default keymaps see this configuration. The documentation describes the default keymaps.