【发布时间】:2019-03-07 19:03:39
【问题描述】:
我使用下面的代码来倾斜 Shiny R,当我运行这段代码时,它给了我这个错误:
警告:hist.default 中的错误:“x”必须是数字 [没有可用的堆栈跟踪]
library(shiny)
ui <- fluidPage(
selectInput("Ind","Indipendent Variable",choices = names(mtcars)),
selectInput('Dep',' Dependent Variable',choices = names(mtcars)),
plotOutput("BoxPlot"),
plotOutput('Hist'))
server <- function(input, output, session) {
data1 <- reactive({input$Ind})
data2 <- reactive({input$Dep})
output$BoxPlot <- renderPlot({boxplot(get(data2()) ~ get(data1()) , data=mtcars)})
output$Hist <- renderPlot({hist(get(data1())})
}
shinyApp(ui, server)
任何帮助为什么会这样说?
【问题讨论】: