title: How do I create a reactive plot using ggplot in Shiny application
body: <p>I have spent several hours trying to figure out how to generate a bar plot using ggplot2 for a shiny app I want to create. The ui works fine, however; the server function generates an empty plot. </p>
  
  <p>The issue is with renderPlot function. I believe I must not be passing the reactive values properly to the aes_string arguments in ggplot.
  C2 is a filtered dataset. The goal is to build a simple app in which the user selects a two variables, a dataset is filtered based upon those variables. The subsetted dataset is passed to ggplot data argument.</p>
  
  <pre><code>       library(shiny)
  library(dplyr)
  
  
  ui &lt;- fluidPage(
    sidebarLayout(
      sidebarPanel(
        selectInput(inputId = "Demog",label = "Factor:",choices = c("HH Income" = "Income",
                                                                    "Age Group" = "Age",
                                                                    "US Region" = "Region") , selected = "Age"),
        selectInput(inputId = "Car",label = "VW Model:",choices = c("BEETLE" = "BEETLE",
                                                                    "CC" = "CC",
                                                                    "EOS" = "EOS",
                                                                    "GOLF" = "GOLF",
                                                                    "GTI" ="GOLF SPORTSWAGEN GTI",
                                                                    "JETTA" = "JETTA",
                                                                    "PASSAT" = "PASSAT",
                                                                    "TIGUAN" = "TIGUAN",
                                                                    "TOUAREG" = "TOUAREG") , selected = "BEETLE"),
        radioButtons(inputId = "Metric",label ="Measurement Type",choices = 
                       c("Conquest Volume Index" = "TotCmpConqVol_IDX","C/D Ratio" = "TotCmpCDRatio_IDX"), selected = "TotCmpConqVol_IDX" )                
  
      )
    ),
    mainPanel(
      tags$h1("The Bar Charts"),
      tags$h2("The metrics"),
  
  
      plotOutput("P1")
  
    )
  
  )
  server &lt;- function(input, output){
    library(ggplot2)
    CONQDF &lt;- read.csv("C:/Users/Reginald/Desktop/CONQ_VW/CONQUEST2.csv")
  
    C2 &lt;- reactive(subset(CONQDF,input$Demog %in% levels(input$Demog)[1] &amp; CONQDF$VW_Model == input$Car))
  
    output$P1 &lt;- renderPlot({
      ggplot(C2(),aes_string(x="CompMake", y=input$Metric))+ geom_bar(stat = "identity")
                            })
  }
  
  
  
  
  
  
  shinyApp(ui,server)
  </code></pre>