作为一项学习练习,我正在尝试将基本的闪亮应用示例(Old Faithful Geyser 发行版)转换为弹性仪表板布局。关于为什么这不显示情节的任何想法?是否需要单独引用server.R文件中的函数?
完整代码如下:
---
title: "DistBins"
output: flexdashboard::flex_dashboard
runtime: shiny
---
```{r global, include=FALSE}
# load data in 'global' chunk so it can be shared by all users of the dashboard
library(shiny)
library(datasets)
data("faithful")
shinyServer(function(input, output) {
output$distPlot <- renderPlot({
# generate bins based on input$bins from ui.R
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
# draw the histogram with the specified number of bins
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
})
```
Column {.sidebar}
-----------------------------------------------------------------------
Adjust number of bins within distribution
```{r}
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30)
```
Column
-----------------------------------------------------------------------
### Distribution
```{r}
# Define server logic required to draw a histogram
renderPlot({
plotOutput("distPlot")
})
```
如果我得到这个工作,将继续工作并报告。