Hadley’s Whole Game video - basic question in markdown output

Have you watched Hadley’s Whole Game video?

How does he get the results of the chunk to display below the chunk in the markdown document (and not in the console?). Similarly, he creates tidy tabular output in the markdown doc - I cannot replicate this behavior. I am sure it has something to do with the options but I can’t see what his options are...

result chunks embedded rather than below in console are a feature of R Notebooks rather than R Markdown per se. look for R Notebook as a file type you can create in the new file menu of Rstudio.

1 Like

Thanks @nirgrahamuk

I try to run the below:

```{r setup}
knitr::opts_chunk$set(message = TRUE)
library(tidyverse)

ending ``` (can't print them here)

but output still prints t0 console and not to notebook

Do I click the green button? Push control enter while in the chunk? What options do I need to ensure are active?

I know its a bunch of stupid questions - but thanks for the help.

I havent watched the video, but its the default behaviour for r notebook when the chunk would have multiple outputs that they get represented with 'buttons'

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

try this file

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

```{r setup}
knitr::opts_chunk$set(message = TRUE, warning=TRUE,  echo = TRUE)
knitr::opts_knit$set(progress = TRUE, verbose = TRUE)
``

```{r}
library(tidyverse)
``
```{r}
plot(cars)
``

replace the `` with ``` to end each chunk

1 Like

thats right, that happens in plain R scripts also.

1 Like

Thanks! Looks like that works! Interestingly, it seems like once a library is loaded, the messages are suspended, so example, if I tried to load library(tidyverse) a second time, the output disappears and is no longer generated in the notebook.

I am now looking at the next section of his code where he prints out permits_raw with a chunk.

His output creates 2 buttons (it appears) in the notebook, 1 for the console output and 1 for the tbl_df output.

Any guidance on how to do this? Thanks!