运行 闪亮文档,内容 table

Run shiny document with table of content

当我添加以下行以将 table 内容添加到发光文档时:

toc: true
toc_float: true

文档无法运行。 运行 没有它们也很好。我收到以下错误:

Error Scanner error: mapping values are not allowed in this context at line 5, column 8(第 5 行是 toc: true

我该如何解决这个问题?

密码我运行:

---
title: "Untitled"
runtime: shiny
output: 
  html_document
    toc: true
    toc_float: true
---

### section 1
```{r, echo=FALSE}
sliderInput("slider", "Number of observations:", 1, 100, 50)

renderText({paste0(rep('blah', 100), collapse = '\n')})
```

### section 2
```{r, echo=FALSE}
renderPlot({hist(rnorm(500)[seq_len(input$slider)])})
```

您只是缺少一个来自 html_document 的 :。应该是html_document:

---
title: "Untitled"
runtime: shiny
output: 
  html_document:
    toc: true
    toc_float: true
---