title: Add "filename" column to table as multiple files are read and bound
body: <p>I have numerous csv files in multiple directories that I want to read into a R tribble or data.table. I use "list.files()" with the recursive argument set to TRUE to create a list of file names and paths, then use "lapply()" to read in multiple csv files, and then "bind_rows()" stick them all together: </p>
  
  <pre><code>filenames &lt;- list.files(path, full.names = TRUE, pattern = fileptrn, recursive = TRUE)
  tbl &lt;- lapply(filenames, read_csv) %&gt;% 
    bind_rows()
  </code></pre>
  
  <p>This approach works fine. However, I need to extract a substring from the each file name and add it as a column to the final table. I can get the substring I need with "str_extract()" like this:</p>
  
  <pre><code>sites &lt;- str_extract(filenames, "[A-Z]{2}-[A-Za-z0-9]{3}")
  </code></pre>
  
  <p>I am stuck however on how to add the extracted substring as a column as lapply() runs through read_csv() for each file. </p>