How can i isolate reactive respond .


#1

Hello,
this is my code:absolutePanel(id = "states", class = "panel panel-default", fixed = TRUE,
draggable = TRUE, top = 60, left = "auto", right = 20, bottom = "auto",
width = 200, height = "auto",
selectizeInput(inputId = "z",
label = "Area",
choices = c("select an area"="","USA","Regions","State"),

          uiOutput("uil")     

)))
)

server <- function(input, output,session) {

output$uil<-renderUI({
switch(input$z,
"State"= selectizeInput(
"st", "State",
choices =c("select a state"="",state.name)),
"Regions"=selectizeInput(
"rig", "Region",
choices = c("select a region"="",unique(m$Region)))

})
i know i put in my placeholder a string, select a region, or select a state which ="". whenever i switch my input , for example from regions to state , my last plot disappear and this error appears: invalid 'type' (list) of argument .
when a choose an input, for example a state or region from the list , my plot appear.

  1. how can i isolate the dependency of NULL or "" value ?
  2. how can i keep my plot till i choose an input from the list.

thank you


#2

Could you add-in a reproducible code?

From the look of it, it seems you need to add an error-handling chunk in your renderPlot() that if (is.null(input$z) || input$z == ""){return (NULL)}

Thanks!
Heramb