0
讓我們來看看這段代碼的動態報表,它基本上是默認模板條到最小:在RMarkdown有光澤,如何包裝輸入面板和renderPlot在一個獨特的呼叫
---
output: html_document
runtime: shiny
---
```{r}
inputPanel(selectInput("n_breaks", label = "Number of bins:",choices = c(10, 20, 35, 50), selected = 20))
renderPlot({hist(faithful$eruptions, probability = TRUE, breaks = as.numeric(input$n_breaks))})
```
我想定義功能f1
這樣我就可以運行,而不是這一點,具有完全相同的輸出:
---
output: html_document
runtime: shiny
---
```{r}
f1()
```
這可能嗎?