title: creating a bar chart with shiny r
body: <p>I am new to R and am looking for help.  I have a csv with two rows (2000, 2010) and two columns (Population 997936 Households 391043 for 2000 and for 2010 1229226 and 474030 respectively).  I am trying to create a reactive bar chart using shiny with radio buttons to select either 2000 or 2010 data and cannot get it to work.  I know it is related to the way I filter but I cannot figure it out.  Here is my code, I would sincerely appreciate any help. As you can see by the comments I have been trying A LOT.</p>
  
  <pre><code>library(shiny)
  
  data &lt;- read.csv("hillsctypop.csv", header = TRUE, sep = ",", stringsAsFactors = FALSE)
  
  ui &lt;- fluidPage(
    titlePanel(title = h4("Hillsborough County Population by Census", align="center")),
    sidebarPanel(
  
      radioButtons("YEAR", "Select the Census Year",
                   choices = c("2000", "2010"),
                   selected = "2000")),
  
  
    mainPanel(
      plotOutput("bar",height = 500))
  )
  
  server &lt;- function(input,output){
    #year = reactive(data({input$YEAR}))
    # filtered &lt;- reactive({
    #data %&gt;%
    #filter(Type == input$year)
    #})
    output$bar &lt;- renderPlot({
     #  barplot(as.matrix(data))
     # barplot(data()[,2,4,])
     #x &lt;- data[1, ]
      color &lt;- c("blue", "red")
  
      barplot(as.integer(data$Population, data$Households),
              main = input$YEAR,
              ylab="Total",
              xlab="Census Year",
              names.arg = c("Population", "Households"),
              col = color)
      #legend("topright", legend = c("Population", "Households"),
      #      fill = c("Blue", "red"))
    })
  }
  shinyApp(ui=ui, server=server)
  </code></pre>