title: Extracting column name from CSV filename during import
body: <p>I have 24 CSV files to import, each with three columns of data: type (CHR), buffer (INT), mean (NUM).  I import these using:</p>
  <pre><code>data &lt;- list.files(path = &quot;...&quot;, pattern = &quot;*.csv&quot;, full.names = TRUE) %&gt;% 
  lapply(read_csv) %&gt;%                                            
  bind_rows
  </code></pre>
  <p>This creates a 'long' data table containing three columns of data.</p>
  <p>To enable monthly analysis I need to extract a date from the filename of each imported CSV to create a 'wide' table (with a column for each <strong>date</strong>), or a 'long' table with <strong>date</strong> as another column).</p>
  <p>Although I've found quite a few suggested ways of doing this I can't get anything to work (I'm relatively new to R) and have become a b it confused by unfamiliar syntax.</p>
  <p>The CSV filename is in the format ABC_YYYY-MM-DD.CSV</p>