title: Filter data frame for use in multiple renderPlot functions
body: <p>I have a shiny app that uses a reactive expression to respond to a user selecting a value from a drop-down list.</p>
  
  <p>The value chosen is then used as a filter condition on a data frame.</p>
  
  <p>If I want to create two different plots of the <strong>same</strong> filtered data frame, do I have to call the reactive expression twice, once for each <code>renderPlot</code> function (as in the example code below), or is there a way to store the results of a filtered data frame for use by different <code>renderPlot</code> calls?</p>
  
  <p><strong>server.R</strong></p>
  
  <pre><code>library(shiny)
  library(dplyr)
  library(ggplot2)
  
  shinyServer(function(input, output) {
  
      ## create dummy data
      set.seed(1)
      location &lt;- c("locA", "locB", "locC")
      location &lt;- sample(location, 20, replace=TRUE)
      service &lt;- c("serviceA", "serviceB")
      service &lt;- sample(service, 20, replace=TRUE)
      person &lt;- c("A", "B")
      person &lt;- sample(person, 20, replace=TRUE)
      value &lt;- runif(20, 0, 5)
  
      df &lt;- data.frame(location, service, person, value)
  
      ## reactive to user input
      select &lt;- reactive({
          input$select
      })
  
      ## plot 1
      output$plot1 &lt;- renderPlot({
          ## filter data frame for use in first plot
          df &lt;- df %&gt;%
              filter(person==select())   ## select() - calls reactive expression
  
          ggplot(data=df, aes(x=location, y=value, fill=person)) +
              geom_bar(stat="identity")
      })    
      ## plot 2
      output$plot2 &lt;- renderPlot({
          ## filter data frame for use in second plot 
          ## this is the same data as in plot1
          df &lt;- df %&gt;%
              filter(person==select())  ## select() - calls reactive expression
  
          ggplot(data=df, aes(x=location, y=value, fill=person)) +
          geom_bar(stat="identity") +
              facet_wrap(~service)
      })  
  })
  </code></pre>
  
  <p><strong>ui.R</strong></p>
  
  <pre><code>library(shiny)
  
  shinyUI(navbarPage("Test",
                     tabPanel("panel",
                              sidebarLayout(
                                  sidebarPanel(
                                      selectInput("select", label="select", choices=c("A", "B"))
                                  ),
                                  mainPanel(
                                      plotOutput("plot1"),
                                      hr(),
                                      plotOutput("plot2")
                                      )
                                  )
                              )
                     )
          )
  </code></pre>
  
  <p>This is just a basic example; my actual application will use the same calculated and filtered data frame in many different plots, so I'd like it not to have to re-run the filter condition for each plot.</p>
  
  <p>So the flow of information would be:</p>
  
  <pre><code>Select_Input &gt; filter_data &gt; (plot1, plot2, plot3, ... plotn)
  </code></pre>