title: Filter through CSV files based on name and updateselectizeInput on R shiny
body: <p>I am new to RShiny (and R in general) and cannot quite figure out how to do the following thing. I have a list of 50 CSV files ending in either P2.csv,P3.csv or P5.csv. I would like to make an app that would allow the user to select a specific price (P2,P3,P5) and then present them with the list of csv files with that ending pattern out of which the user could then select maximum 3 that would need to be loaded into memory.</p>
  <p>I have found separately how to list all the files with the specific ending and I figured that I would need to use updateSelectizeInput so that each time the user selects a price (e.g. P2) he gets presented with all the csv files appleP2.csv, orangeP2.csv etc for example, but cannot think of a way to make this work.</p>
  <p>Any help is greatly appreciated! Thank you.</p>
  <pre><code>library(shiny)
  
  #listing the csv files ending with a same pattern 
  same_price_P2&lt;-list.files(pattern=&quot;P2.csv&quot;)
  same_price_P3&lt;-list.files(pattern=&quot;P3.csv&quot;)
  same_price_P5&lt;-list.files(pattern=&quot;P5.csv&quot;)
  
  shinyUI(fluidPage(
    
    titlePanel(&quot;Price of fruit&quot;),
    
    #user can select the price of the fruit
    selectInput(&quot;Price&quot;, &quot;Price&quot;, choices = c(&quot;5 euros&quot;=&quot;P5&quot;, &quot;2 euros&quot;=&quot;P2&quot;, &quot;3 euros&quot;=&quot;P3&quot;), selected=&quot;P2&quot;, multiple=FALSE)),
    
    #user must be presented only with the CSV files associated to the selected price and can select maximum of 3 
    #files to be read 
    selectizeInput(&quot;Fruit&quot;, &quot;Fruit&quot;, choices = &quot;&quot;, selected = NULL, multiple=TRUE, options=list(maxItems=3)),
    
  
    
    tableOutput(&quot;dataset&quot;)
  )
  
  
  shinyServer(function(session, input, output){
    
    
    #Populate this by filtering through and showing the csv files based on whether they end in P2.csv, P5.csv, P3.csv
    #the selected files by the user should then be read
    observeEvent(
      input$Price,
      updateSelectizeInput(session, &quot;Fruit&quot;, &quot;Fruit&quot;, 
                        choices = ................[..........==input$Price]))
    
   
    output$dataset &lt;- renderTable({
      data
    })
    
  })
  </code></pre>