remacsr-markdowness

execute all R chunks at once from an Rmd document


A minimal Rmarkdown document has a YAML header, markdown syntax and R code chunks. To edit such a multi-language file, I am using the Emacs editor, and the buffer in which the Rmd document is opened, is in polymode.

A typical document has more than one R chunk. When I am writing/debugging an R chunk in the middle of the Rmd document, I have a second buffer in the ESS mode with R running inside, and I often have to re-execute all previous chunks by sending the R commands from the Rmd file (1st buffer) into the into R console (2nd buffer).

Is there a single command allowing to execute all commands from all chunks?

From another question, it seems like org-mode can do this. But would it be possible to do it in my setting?


Solution

  • If using Poly-Markdown+R, the command to evaluate all R snippets in an Rmarkdown document is M-n v b.

    Reference