title: How do I use the output generated from another output with a Shiny app?
body: <p>I want to use a dataframe that is generated based off an input in multiple outputs. Is there a way I can generate this output just once versus doing it for every output?</p>
  
  <p>For example,The user will generate give their input such as a date</p>
  
  <pre><code>dateRangeInput("date", label = "Delivered Date Range: ", start = ld, end = hd)
  </code></pre>
  
  <p>I will then use that date range input in multiple outputs. However, two outputs require the same query to get the same dataframe using that input.</p>
  
  <pre><code>output$p1 &lt;- renderPlotly({
    q1 &lt;- "
    SELECT *
    FROM table
    WHERE date &gt; '"
    q2 &lt;- input$date[1]
    q3 &lt; "'"
    p1_df &lt;- sqlQuery(DS, q)
    plot_ly(data = p1_df, x = ~x, y = ~y)
  })
  
  output$p2 &lt;- renderPlotly({
    q1 &lt;- "
    SELECT *
    FROM table
    WHERE date &gt; '"
    q2 &lt;- input$date[1]
    q3 &lt; "'"
    p2_df &lt;- sqlQuery(DS, q)
    plot_ly(data = p2_df, x = ~x, y = ~y)
  })
  </code></pre>
  
  <p>Is there a way in Shiny that I only have to run this query once as to make my app more efficient? </p>
  
  <p>Thanks </p>