在RMarkdown中解释knitr chunk的'eruptions'变量选项

时间:2017-04-15 14:58:03

标签: r markdown rstudio knitr r-markdown

我从RStudio base Rmarkdown-Shiny运行时模板获得了以下knitr块:

```{r eruptions, echo=FALSE}
inputPanel(
  selectInput("n_breaks", label = "Number of bins:",
              choices = c(10, 20, 35, 50), selected = 20),

  sliderInput("bw_adjust", label = "Bandwidth adjustment:",
              min = 0.2, max = 2, value = 1, step = 0.2)
)

renderPlot({
  hist(faithful$eruptions, probability = TRUE, breaks = as.numeric(input$n_breaks),
       xlab = "Duration (minutes)", main = "Geyser eruption duration")

  dens <- density(faithful$eruptions, adjust = input$bw_adjust)
  lines(dens, col = "blue")
})
```

eruptions

{r eruptions, echo=FALSE}选项的用途是什么?

1 个答案:

答案 0 :(得分:1)

这是块的名称。

您不能为不同的块提供相同的名称。