title: How to further aggregate filtered data in Shiny R
body: <p>Here is how my input looks:</p>
  
  <pre><code>OrderDate | Company | ApprovalID | Amount |State,
  2009-01-02 | A | AC | 200 | NY,
  2009-01-05 | A | BT | 20000 | NY,
  2009-01-04 | A | AC | 500 | CO,
  2009-01-02 | B | XY | 2000 | TX,
  2009-05-41 | B | XY | 30 | TX,
  2009-04-21 | D | CR | 2222 | BR,
  </code></pre>
  
  <p>I am letting my user input a date range and company</p>
  
  <pre><code>                       tabPanel("Plot", fluid = TRUE,
                                  sidebarLayout(
                                      sidebarPanel(id = 'sidebar',
                                          dateRangeInput("dateinput","Selects Dates",start = Sys.Date()-30,end = Sys.Date()),
                                                   selectInput("companyinput", "Select Comp", choices=choices1,multiple = TRUE,selected = NULL) 
                                                   ),
  </code></pre>
  
  <p>So if the user chooses dates between 2009-01-01 and 2009-01-31 and company A. I want to have a table that shows:</p>
  
  <pre><code>OrderDate | Company | ApprovalID | Amount |State ,
  2009-01-02 | A | AC | 200 | NY ,
  2009-01-05 | A | BT | 20000 | NY,
  2009-01-04 | A | AC | 500 | CO,
  </code></pre>
  
  <pre><code>   filtered &lt;- reactive({
              if(is.null(input$companyinput)){
              bc3 %&gt;%
                  filter(as.Date(OrderDate) &gt; input$dateinput[1],
                         as.Date(OrderDate) &gt;= input$dateinput[2],
                  )
  
                  }
              else{
                  bc3 %&gt;%
                      filter(as.Date(OrderDate) &gt; input$dateinput[1],
                             as.Date(OrderDate) &gt;= input$dateinput[2],
                             CompanyNameID == input$companyinput
                      )
  
  </code></pre>
  
  <p>But then in the same dashboard I want to show different charts:</p>
  
  <p>Further Aggregated at ApprovalID and Amount i.e. let us say a bar chart showing
  AC spent 700 and BT spent 20000 (previous filters or order date and company intact)
  then other chart
  Aggregated at State and Amount i.e let us say a bar chart showing state and amount (once again order date and company that user has chosen)</p>
  
  <p>Is there a way of doing so, or of storing the reactive input as dataframe so I can manipulate it as and how I want.</p>
  
  <p>Thanks,
  HV</p>