title: doing map using shiny and ggplot2
body: <p>I am unable to subset a dataframe within a reactive shiny structure and display it as plot (using ggplot). <a href="https://i.stack.imgur.com/YAvND.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YAvND.png" alt="enter image description here"></a>
  I want to have something with map like that, in my shiny app and of course to change the map with the "Choisir une votation"(refering to my input$objet) <a href="https://i.stack.imgur.com/35Xuz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/35Xuz.png" alt="enter image description here"></a>
  here is my ui.r</p>
  
  <pre><code>library(shiny)
  
   shinyUI(fluidPage(
  
  
   titlePanel("Swiss votations tool"),
  
   # Sidebar with a slider input for number of bins
   sidebarLayout(
   sidebarPanel(
  
          selectInput("objet", "Choisir une votation",
                      levels((df.merge$Date.et.objet))
          )
  ),
  
  # Show a plot of the generated distribution
  mainPanel(
   plotOutput("plot")
    )
  )
  ))
  </code></pre>
  
  <p>and my server.r (i think i'm doing something with the reactive wrong and/or stupid here...)</p>
  
  <pre><code>shinyServer(function(input, output) {
     df.merge2&lt;-reactive({
       df.merge2&lt;-df.merge[input$objet,]
       d &lt;- as.data.frame(df.merge2)
       d
        }) 
  
   output$plot &lt;- renderPlot({ 
  
   df.merge2&lt;-df.merge2()
  
   p &lt;- ggplot() +geom_polygon(data=df.merge2,                    
      aes(fill =as.numeric(df.merge2$Pourcentage.de.oui),                
      x = df.merge2$long, y = df.merge2$lat, group = df.merge2$group))
   p &lt;- p+geom_path(data=df.merge2, 
         aes(fill=as.numeric(df.merge2$Pourcentage.de.oui),x = 
          df.merge2$long,  y = df.merge2$lat, group = df.merge2$group), 
          color = "white", size = 0.1) 
   p &lt;- p+scale_fill_gradient(low ="#ffffcc" , high = "#253494")
   print(p)
     })
  
      })
  </code></pre>
  
  <p>Think you for help, I quite new to shiny</p>
  
  <p>my data:
  dataframe with
      str(df.merge)
      'data.frame':   156672 obs. of  26 variables:
  and geographic informations</p>