【发布时间】:2017-05-06 01:56:31
【问题描述】:
我正在开发我的第一个 Shiny 应用程序,试图制作一个反应式条形图和表格,用户可以在其中选择要显示的数据框的列,但是,当我运行应用程序时,
错误:需要出现有限的“xlim”值
.
我的数据不包含 NA,它是一个数据框,我可以使用普通的 r 命令构建非反应图。
我的代码是这样的
library(shiny)
ui <- fluidPage(
plotOutput(outputId = "bar_1"),
tableOutput(outputId = "table_1"),
selectInput("variable", "Select variable", c("colA"="colA", "colB"="colB", "colC"="Col C"))
)
server <- function(input, output) {
output$bar_1<-renderPlot(barplot(table(Book1$'input$variable')))
output$table1<-renderTable(table(Book1$'input$variable'))
}
shinyApp(ui = ui, server = server)
控制台显示
Warning in min(w.l) : no non-missing arguments to min; returning Inf
Warning in max(w.r) : no non-missing arguments to max; returning -Inf
Warning in min(x) : no non-missing arguments to min; returning Inf
Warning in max(x) : no non-missing arguments to max; returning -Inf
Warning: Error in plot.window: need finite 'xlim' values
Stack trace (innermost first):
79: plot.window
78: barplot.default
77: barplot
76: renderPlot
68: output$bar_1
1: runApp
感谢您的帮助!
【问题讨论】: