2
votes

I was wondering whether it was possible to disable chunk output for RStudio's html_notebooks in the Source pane, so that output is only displayed in the Viewer pane (or in a separate Window, depending on your settings).

  • I can manually close output of a single chunk in the Source pane by clicking on the "x" on the right of a code chunk, but this seems tedious.
  • I can also control output with include=FALSE, but this obviously also affects the Viewer pane where I would like to have my output displayed.
  • Edit: I would like to stick with the html_notebook format as updating changes with the notebook preview is much faster than knitting an html_document.

Minimal Working Example (saved as test.Rmd):

---
title: "R Notebook Test"
output: html_notebook
---


HSome text here. 

```{r chunk1}
2+2
```

Some more text here. 

The MWE results in the following output in the Source pane ...

R source pane

... and the following output in the Viewer pane:

R viewer pane

I am happy with the Viewer pane but do not want to see the output in the Source pane.

Why am I asking this question?

I think the option of having output displayed in the Source pane is nice but since inline code chunks are not also rendered in the Source pane I prefer just having the output displayed once in the Viewer pane.

1

1 Answers

1
votes

It seems to me that what you need is html_document, (not html_notebook) where the source pane only has your code, but the viewer pane contains the processed chunks ?

Try changing html_notebook to html_document and see if that is what you need. That will give you a clean source document and processed output in the window/viewer.

The html_notebook mode is specifically for dealing with

" chunks that can be executed independently and interactively, with output visible immediately beneath the input."

(see http://rmarkdown.rstudio.com/r_notebooks.html).