robertspierre
robertspierre

Reputation: 4457

R Markdown: how to hide plots from being plotted inside RStudio?

I have a R Markdown file in RStudio.

I have the following code:

```{r, fig.show="hide"}
plot(tree.boston)
text(tree.boston, pretty=0)
```

When I click on Run -> Run All (or Ctrl+Alt+R), the plot is included inside RStudio. That is, below the code, the plot appears.

How can I prevent the plot inside RStudio? I don't want plots below my code.

Upvotes: 1

Views: 562

Answers (3)

Angel Garcia Campos
Angel Garcia Campos

Reputation: 138

Add this to the preamble of your Rmd

editor_options:
    chunk_output_type: console

Upvotes: 1

dfrankow
dfrankow

Reputation: 21469

In Preferences / R Markdown, there is a checkbox:

Show output inline for all R Markdown documents

Unselect it.

The plots will still be in the PDF output, but not inside the RStudio browser.

This answers the question you asked if I ignore the comments: how to get rid of the plots inside RStudio. I wanted this too, which is why I answered it here.

In the comments you said you wanted to get rid of the plots everywhere, including the output PDF. In that case, @daniel-jachetta's answer is better.

Upvotes: 0

Daniel_j_iii
Daniel_j_iii

Reputation: 3252

```{r, include=FALSE}
plot(tree.boston)
text(tree.boston, pretty=0)
```

Should High the plot within Rstudio

Upvotes: 1

Related Questions