2

So if I have some code, such as:

---
title: "Data Exploration"
output: html_notebook
---

```{r, echo = 2}
data("mtcars")
summary(mtcars$mpg)
```

then I would expect only the 2nd line, i.e. summary(mtcars$mpg) to show in my previewed document. But what it actually does is remove all code from my previewed document and removes the show/hide code toggle button. Any idea how I can show certain lines whilst keeping the toggle button?

nathaneastwood
  • 3,664
  • 24
  • 41
  • With `code_folding : show` and rmarkdown v1.8 your code works as expected. Can you post the whole rmarkdown file? – psychOle Sep 25 '18 at 12:00
  • I've added the YAML, this is literally it. I'm on rmarkdown v1.10 – nathaneastwood Sep 25 '18 at 12:02
  • `code_folding: show` isn't exactly what I want. Whilst it "hides" the code, it doesn't remove it from the preview completely. I want only the second line, i.e. the `summary()` to be included in the document – nathaneastwood Sep 25 '18 at 12:05

1 Answers1

0

I would have added this as a comment, but I do not have that capability yet. This seems like it might be a bug. It works fine in the other document types. If you need to use a notebook the not so elegant work around would be to just use two chunks.

jamesguy0121
  • 1,124
  • 11
  • 28