multiple drop-down bottoms in Shiny as filters for the data

后端 未结 1 1914
-上瘾入骨i
-上瘾入骨i 2021-01-16 14:31

I want to apply multiple drop-down bottoms in Shiny as filters for the data. I found the following example. In this example one load a fixed data, namely mpg fr

相关标签:
1条回答
  • 2021-01-16 15:07

    I think the problem lies in the server. Try this

    function(input, output) {
    
      #read the data 
      dataset <- reactive({
      infile <- input$date
      if (is.null(infile)){
        return(NULL)
      }
      data<-read.table(paste0('---/data/',infile),header=TRUE, sep=";")
      data[is.na(data)]<- 0
    
      if (input$konz != "All") {
       data <- data[data$Konzernbezeichnung == input$konz,]
      }
      if (input$group != "All") {
       data <- data[data$Bestandseingruppierung == input$group,]
      }
      if (input$lgdK != "All") {
       data <- data[data$LGD.Klasse == input$lgdK,]
      }
      })
    
      # Filter data based on selections
      output$plot <- renderPlot({
    
       x <- dataset()$Marktwert
       hist(x, breaks = 40)
    
      })
    
     }
    
    0 讨论(0)
提交回复
热议问题