Clear the current output from entire RMarkdown (Rmd) document in RStudio?

Viewed 1046

Especially when working with long RMarkdowns (e.g. 2-3000+ lines), it is desirable to completely clear all rendering and output (i.e. to get back to the same state as though none of the code in the RMarkdown had ever been executed), except without necessarily clearing the environment.

Is there a way to do this?

Note: in case someone wonders why, here are a couple of reasons:

  1. occasionally (especially with javascript-heavy renderings, e.g. plotly, wordcloud etc) there can occasionally be bugs which not only affect the rendering that contains the bug, but all other renderings in the document, and
  2. particularly in long Rmd files, it is sometimes simply easier to scroll through a doc which hasn't got renderings in it.
1 Answers

Click on the gear icon to the right of the "Knit" button at the top of your R Studio dashboard.

The very last option is "Clear All Output".

This should be what you are looking for.

Related