类型为'的对象;关闭';不可再附加:R闪亮应用程序

类型为'的对象;关闭';不可再附加:R闪亮应用程序,r,graph,shiny,R,Graph,Shiny,我正试图创建图形应用程序使用R闪亮。因此,我从用户处获取路线、站点/行程id(上车、下车或上车)的输入。因此ui.r是 ui <- fluidPage( pageWithSidebar( headerPanel('FAST_TRIPS Visulization', windowTitle = "Fast_trips Visaualization"), sidebarPanel( selectInput('route', 'Choose the Route N

我正试图创建图形应用程序使用R闪亮。因此,我从用户处获取路线、站点/行程id(上车、下车或上车)的输入。因此ui.r是

ui <- fluidPage(
  pageWithSidebar(
    headerPanel('FAST_TRIPS Visulization', windowTitle = "Fast_trips Visaualization"),
    sidebarPanel(
      selectInput('route', 'Choose the Route No.', unique(y['route_id'])),
      selectInput('id', 'Please Choose Stop or Trip ID', c('stop_id','trip_id')),
      selectInput('rider', 'What do you wanna compare?', c('boarding', 'alighting', 'load')),
      radioButtons('method','Please select your method', c('Sum', 'Average'))),
    mainPanel(

      plotOutput('plot1')

    )
  )
)

请帮我做这个。我不熟悉shiny。

您应该将被动表达式作为函数访问,因此您需要将
()
添加到对作为被动表达式创建的变量的任何调用中

而不是:

subset(selectedData,route\u id==input$route)

尝试使用:

subset(selectedData(),route\u id==input$route)

或者甚至使用一个额外的变量来避免问题

selectedData_ <- selectedData()
subset(selectedData_, route_id == input$route)
仅使用

output$plot1 <- renderPlot({
  a_ <- a()
  barplot(a_[input$rider])
})

output$plot1您应该作为函数访问被动表达式,因此您需要将
()
添加到对作为被动表达式创建的变量的任何调用中

而不是:

subset(selectedData,route\u id==input$route)

尝试使用:

subset(selectedData(),route\u id==input$route)

或者甚至使用一个额外的变量来避免问题

selectedData_ <- selectedData()
subset(selectedData_, route_id == input$route)
仅使用

output$plot1 <- renderPlot({
  a_ <- a()
  barplot(a_[input$rider])
})
输出$plot1
output$plot1 <- renderPlot({
  a_ <- a()
  barplot(a_[input$rider])
})