title: Shiny - conditionalPanel - set condition as output from server
body: <p>I am trying to build an app in shiny that will be able to load a dataset in the server function and then based on the user choose and then if there is a factor variable to open check box using conditionalPanel. is there a way to output variable from the server as the condition of the condtionalPanel?</p>
  
  <p>Here is what I tried:</p>
  
  <pre><code>library(shiny)
  library(caret)
  
  ui &lt;- fluidPage(
    selectInput('dataset', 'Select Dataset', 
                list(GermanCredit = "GermanCredit",
                    cars = "cars")),
  
    conditionalPanel(
      condition = "output.factorflag == true",
      checkboxInput("UseFactor", "Add Factor Variable")
    ) 
  )
  
  
  server &lt;- function(input, output) {
    # Loading the dataset
    df &lt;- reactive({
      if(input$dataset == "GermanCredit"){
        data("GermanCredit")
        df &lt;- GermanCredit
      }else if(input$dataset == "cars"){
        data(cars)
        df &lt;- cars
      }
  
      return(df)
    })
  
    # Loading the variables list
    col_type &lt;- reactive({
      col_type &lt;- rep(NA,ncol(df()))
      for(i in 1:ncol(df())){
        col_type[i] &lt;- class(df()[,i])
      }
      return(col_type)
    }) 
  
    outputOptions(output, "factorflag", suspendWhenHidden = FALSE)
  
  
    output$factorflag &lt;- reactive({
      if("factor" %in% col_type()){
        factor.flag &lt;- TRUE
      } else {factor.flag &lt;- FALSE}
    }
    )
  }
  
  
  shinyApp(ui = ui, server = server)
  
  Thank you in advance!
  </code></pre>