title: Dynamic UI with googlevis plot in Shiny
body: <p>I am having a bit of an issue trying to get a dynamic UI to work with googlevis. Essentially I want to allow a user to input a range of interest with a slider bar and the plot to change accordingly. In the following example I've used data sets from the googlevis package to illustrate what I mean. If you run the code below you will get no errors, however no plots are produced: </p>
  
  <p><strong>ui.R</strong></p>
  
  <pre><code>library(shiny)
  
  shinyUI(fluidPage(
    titlePanel("Example"),
    sidebarLayout(
      sidebarPanel(
        radioButtons('data_choice', 'choose a dataset', 
                     choices= c('dataset1', 'dataset2')),
        uiOutput('slider')
      ),
      mainPanel(
        htmlOutput('view')
  
      )
    )
  ))
  </code></pre>
  
  <p><strong>server.R</strong></p>
  
  <pre><code>library(shiny)
  library(googleVis)
  library(ggplot2)
  
  dataset1= dino
  dataset2= Fruits[,c(1,6)]
  
  shinyServer(function(input, output) {
  
    #Output new slider depending on dataset chosen
    output$slider&lt;- renderUI({
      if(input$data_choice== 'dataset1'){
        sliderInput('rangeSlider', 'Choose data range',
                    min= 0, max= max(dataset1$Length),
                    value= c(0, max(dataset1$Length)))
  
      }else if(input$data_choice== 'dataset2'){
        sliderInput('rangeSlider', 'Choose data range',
                    min= 0, max= max(dataset2$Profit),
                    value= c(0, max(dataset2$Profit)))
      }
    })
  
    #plot adjust
    adjustPlot&lt;- reactive({
      #Adjust dataframes based on input from slider
  
      if(input$data_choice== 'dataset1'){
        adjusted_dataset1&lt;- subset(dataset1, 
                                   Length &gt;= input$rangeSlider[1] &amp; Length &lt;= input$rangeSlider[2])
  
      }else if(input$data_choice== 'dataset2'){
        adjusted_dataset2&lt;- subset(dataset2, 
                                   Profit &gt;= input$rangeSlider[1] &amp; Profit &lt;= input$rangeSlider[2])
      }
  
    })
  
    output$view &lt;- renderGvis({
      gvisBarChart(adjustPlot(), options= list(height= 700))
    })
  
  })
  </code></pre>
  
  <p>If you replace the output with a ggplot plot and not googlevis the code runs fine. </p>
  
  <p><strong>ui.R</strong></p>
  
  <pre><code>mainPanel(
        plotOutput('view')
      )
  </code></pre>
  
  <p><strong>server.R</strong></p>
  
  <pre><code>  #ggplot that works 
    output$view &lt;- renderPlot({
      if(input$data_choice=='dataset1'){
        p&lt;-ggplot(adjustPlot(), aes(x=Dinosaur, y=Length)) 
        p&lt;-p + geom_bar(stat='identity', fill='navyblue') + coord_flip()
  
      }else if(input$data_choice=='dataset2') {
        p&lt;-ggplot(adjustPlot(), aes(x=Fruit, y=Profit)) 
        p&lt;-p + geom_bar(stat='identity', fill= 'forestgreen') + coord_flip()
  
      } 
  
      print(p)
  
    }, height=550)
  </code></pre>
  
  <p>It seems as though there is an issue with the rendering of the google plot to the application when taken inputs from renderUI (perhaps because it renders it as html..). Any assistance would be much appreciated. Thanks! </p>