title: filter data in shiny app but keeping values in selectInput when updating table
body: <p>I have an shiny app that ask the user to upload a file (a tabulated file with data), then it renders this file into a table and the user can filter some values based on <code>numericInput</code>, <code>selectInput</code>, and <code>textAreaInput</code>. The user has to select the filters and then press a button in order to filter the table. </p>
  
  <p>There is no sequential filtering, i.e, the user can fill all the filters or just one. Every time the user choose a filter the value of the other filters get updated (<code>selectInput</code> inputs) and this is the behaviour I want. However, once the <strong>Filter</strong> button is pressed, I can't see the previous selection and also I can't reset the filters. </p>
  
  <p>What I would like to achieve is to maintain the actual behaviour when updating the filters, i.e, once I choose a filter and press the filter button the other <code>selectInput</code> choices are automatically updated, <strong>BUT</strong> I want to keep track of the filters choices, so the user can see the filters he/she has selected. That was what I was expecting but everytime I press the button <strong>Filter</strong> it seems that the filter tab is rendered again.</p>
  
  <p>Here is my app, </p>
  
  <pre><code>library(shiny)
  library(vroom)
  library(dplyr)
  library(shinycssloaders)
  library(shinydashboard)
  library(shinydashboardPlus)
  library(tidyr)
  
  
  header &lt;- dashboardHeader()
  
  sidebar &lt;- dashboardSidebar(width = 450,
  
    sidebarMenu(id="tabs", 
      menuItem("Filtros", tabName="filtros", icon = icon("bar-chart-o")),
        uiOutput("filtros")
  
    )
  )
  
  body &lt;- dashboardBody(
  
    tabItems(
      tabItem(tabName="filtros",
            fluidRow(
            column(12,dataTableOutput("tabla_julio") %&gt;% withSpinner(color="#0dc5c1"))
          )
      )  
     )
   )
  
  ui &lt;- dashboardPagePlus(enable_preloader = TRUE, sidebar_fullCollapse = TRUE, header, sidebar, body)
  
  server = function(input, output, session) {
  
      #Create the choices for sample input
      vals &lt;- reactiveValues(data=NULL)
      vals$data &lt;- iris
  
  
  
    output$filtros &lt;- renderUI({
  
      datos &lt;- vals$data
        conditionalPanel("input.tabs == 'filtros'",
          tagList(        
              div(style="display: inline-block;vertical-align:top; width: 221px;",numericInput(inputId="Sepal.Length", label="Sepal.Length", value=NA, min = NA, max = NA, step = NA)),                      
              div(
                div(style="display: inline-block;vertical-align:top; width: 224px;", selectInput(inputId = "Species", label = "Species", width = "220",  choices=unique(datos$Species), 
                selected = NULL, multiple = TRUE, selectize = TRUE, size = NULL))
                )
              ),
              actionButton("filtrar", "Filter")
            )
      })
  
  # create reactiveValues
  
    vals &lt;- reactiveValues(data=NULL)
    vals$data &lt;- iris
  
  
  # Filter data
  
  observeEvent(input$filtrar, {
  
        tib &lt;- vals$data
  
        if (!is.na(input$Sepal.Length)){
          tib &lt;- tib %&gt;% dplyr::filter(!Sepal.Length &gt;= input$Sepal.Length)
          print(head(tib))
        } else { tib &lt;- tib }
  
        # Filter
        if (!is.null(input$Species)){
          toMatch &lt;- paste0("\\b", input$Species, "\\b")
          matches &lt;- unique(grep(paste(toMatch,collapse="|"), tib$Species, value=TRUE))
          tib &lt;- tib %&gt;% dplyr::filter(Species %in% matches)
        } else { tib &lt;- tib}
  
        tib -&gt; vals$data
        print(head(tib, n=15))
  
      })
  
  
    # Reactive function creating the DT output object
    output$tabla_julio &lt;- DT::renderDataTable({        
        DT::datatable(vals$data) 
      })
  
  }
  
  shinyApp(ui, server)
  
  </code></pre>