0
votes

As the title - I want to be able to use YAML tags like toc: true and toc_float: true for use in an RNotebook file. Currently I have this:

```

title: "R Notebook" output: html_notebook:

toc:true

Section 1

This is an R Markdown Notebook. W

Section 2

{r} plot(cars) ```

Which gives me an error of : Error in yaml::yaml.load(string, ...) : Scanner error: while scanning for the next token at line 3, column 1found character that cannot start any token at line 3, column 1

The document loads, but without the toc.

1

1 Answers

0
votes

try this exemple from the rstudio basic one

---
title: "R Notebook"
output:
  html_notebook:
    toc: yes
    toc_float: yes
  html_document:
    toc: yes
---

# blabla section 1

This is an [R Markdown](http://rmarkdown.rstudio.com) Notebook. When you execute code within the notebook, the results appear beneath the code. 

Try executing this chunk by clicking the *Run* button within the chunk or by placing your cursor inside it and pressing *Ctrl+Shift+Enter*. 

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

# blabla section 2

Add a new chunk by clicking the *Insert Chunk* button on the toolbar or by pressing *Ctrl+Alt+I*.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the *Preview* button or press *Ctrl+Shift+K* to preview the HTML file).