title: R: Importing CSV data based on multiple AND and OR conditions of the file names
body: <p>I need help in Importing CSV data based on multiple AND and OR conditions of the file names in R</p>
  <p>I have a folder containing CSV files (820 in total), with each contains a fixed and identical format table, with different values populating the tables.</p>
  <p>The CSV files can be categorized into multiple groups based on three variables: species, RCP, MSY. Please see below the table of the CSV filenames (file.dir) with the variables identified
  <img src="https://i.stack.imgur.com/U0QWo.png" alt="table" /></p>
  <p>I have 82 species (code), 2 RCPs and 5 MSYs, that totaled up to 820 CSV files/tables. I am currently using this code to import my csv, but my skill is limited to only one regular expression for &quot;pattern=&quot;:</p>
  <pre><code>all_paths &lt;- list.files(path = &quot;C:/#File.dir&quot;, pattern = &quot;rcp85&quot;, full.names = TRUE)
  </code></pre>
  <p>I wish to import the csv based on:</p>
  <ol>
  <li>file names which has one of the names in the list of species (code) that is neither continuous nor in order. i.e. species codes in file name: <strong>60002</strong>,60005,<strong>600042,600058</strong>,600062,600089,<strong>600092</strong>,600100 (I want to select <strong>bold</strong> only)</li>
  <li>import CSV file names containing either msy1 or msy3. Which means I wish to have both msy1 and msy3 imported simultaneously</li>
  <li>Import the files in R with both conditions in (1) and (2) are met.</li>
  </ol>
  <p>May I know how do I improve/express the script attached to meet my aim? or do I have to use extra packages to do so?</p>
  <p>I hope my aims are not too confusing for anyone who reads it. Please do let m know if more information are required. Thanks a lot for your time!</p>
  <p>Cheer,
  Boo</p>