闪亮的仪表板-警告:过滤器错误:未找到对象“合成”

时间:2019-11-11 13:11:38

标签: r shiny

我正在尝试使用valuebox函数的输入来更改selectinput,但出现此错误:

  

过滤器中的错误:找不到对象“合成”。

数据来自PostgreSQL,我在数据框中添加了新列。 这是我从“ body”开始编写的代码:

body <- dashboardBody(
    #box(title= "Groups' syntheses", status = "primary", solidHeader=T, width = 12,
        #fluidPage(fluidRow(
            #column(2, offset = 0, style='padding:1px;',
                 #selectInput("select the input","select the synthesis version"
                  #, unique(all$synthesis)))))),

    fluidRow(
    valueBoxOutput("value1", width=2)
    , valueBoxOutput("value2", width=2)
   ),

 fluidRow(
    box(
      title= "Indicators of groups' performance" 
      , status = "primary", solidHeader = TRUE
      , plotOutput("plot2", height = 250))
  ))

ui <- dashboardPage(title = 'GDPA', header,
                    sidebar,
                    body
)

server <- function(input, output) {

  # create the server functions for the dashboard  
  all <- data.frame(synthesis = c(1,2,3,1,2,3,1,2,3,1,2,3,1,2,3,1,2,3),
                    test1_count <- count(test1, c("groupname", "synthname")))

  oia <- reactive({req(input$synth)
    filter(all, (synthesis == c(input$sinth)) & (groupname == 'EA35')
 )})

  EA50 <- all [which(all$synthesis == '1' & all$groupname == 'EA50'),]


    #creating the valueBoxOutput content
  output$value1 <- renderValueBox({ req(oia())
    Value <- oia()$freq
    valueBox(
      Value
      ,'EA 35'
      ,color = "green")
  })
  output$value2 <- renderValueBox({
    valueBox(
      EA50$freq
      ,'EA 50'
      ,color = "navy")
  })

  output$plot2 <- renderPlot({
    ggplot(test1, aes(groupname)) + 
      geom_bar(position="dodge", width = 0.5) + ggtitle ("") +
      scale_color_grey()+ scale_fill_grey() +
      theme_classic()
  })
}

shinyApp(ui, server)

0 个答案:

没有答案