R ShinyApp -- Reactive input fields are null on first pass filling log with errors -
i'm new r , shiny , use help. we're writing shinyapp reads 3 data sources uses 10 filter fields limit input. 10 fields dynamic; user can choose filter in 1 field , value filter should take in second field.
when input fields read in reactive function filters validated , because null throwing "warning: error in if: argument of length zero" warnings cluttering console output. there standard way of handling this? filter selection looks like:
filtered.d1.off <- reactive({ if(is.null(input$filter0101)){ input$filter0101 <- "unknown"} if(input$filter0101 %in% ranges){ which(basedata.off()[[input$filter0101]] >= input$filterselect0101[1] & basedata.off()[[input$filter0101]] <= input$filterselect0101[2]) }else{ which(basedata.off()[[input$filter0101]] %in% input$filterselect0101) }
})
filtered.d2.off <- reactive({ browser() if(length(input$filterselect0102) == 0){ filtered.d1.off() }else if(input$filter0102 %in% ranges){ intersect(which(basedata.off()[[input$filter0102]] >= input$filterselect0102[1] & basedata.off()[[input$filter0102]] <= input$filterselect0102[2]), filtered.d1.off()) }else{ intersect(which(basedata.off()[[input$filter0102]] %in% input$filterselect0102), filtered.d1.off()) } })
this continues on 8 more potential filters. i'd rid of these warning messages more other problems in code , improve user experience. input appreciated.
wiki
Comments
Post a Comment