title: Swap point colors in shiny
body: <p>I have a shiny app that displays a plot with ggplot. I want to make a pulldown that lets users switch between two color schemes for the points. ui:</p>
  
  <pre><code>pageWithSidebar(
      headerPanel('PCA'),
      sidebarPanel(
         selectInput('colorBy', 'Color By', c('red', 'blue'))
      ),
      mainPanel(
        plotOutput('plot1')
      )
   )  
  </code></pre>
  
  <p>Server code (including some pseudocode):</p>
  
  <pre><code>function(input, output, session) {
  
    # create new columns with alternate color schemes
    iris$red = rep('red', (dim(iris)[1]))
    iris$blue = rep('blue', (dim(iris)[1]))
  
    #FIXME  
    # set the color scheme 
    colorScheme &lt;- reactive({
      if (input$colorBy == 'red'){
        iris$red
      }
  
      else{
        iris$blue
      }
    })
  
   # make the plot
   output$plot1 &lt;- renderPlot({
     ggplot(iris, aes(Sepal.Length, Sepal.Width)) +     geom_point(colour=colorScheme)
    })
  
  }
  </code></pre>