title: Use dataframe name while mutating across many dataframes in R
body: <p>I need to make a new column in each of 96 different dataframes that is the name of the dataframe (the name is informative). It's easiest to just show you what I mean.</p>
  <pre><code>&gt; wolf &lt;- data.frame(test1 = c(3,2,4,3),
  +                    test2 = c(4,5,2,4))
  &gt; bear &lt;- data.frame(test1 = c(3,5,6,1),
  +                    test2 = c(4,6,2,4))
  &gt; wolf
    test1 test2
  1     3     4
  2     2     5
  3     4     2
  4     3     4
  &gt; bear
    test1 test2
  1     3     4
  2     5     6
  3     6     2
  4     1     4
  </code></pre>
  <p>I would like the output to be:</p>
  <pre><code>&gt; wolf
    test1 test2 animal
  1     3     4   wolf
  2     2     5   wolf
  3     4     2   wolf
  4     3     4   wolf
  &gt; bear
    test1 test2 animal
  1     3     4   bear
  2     5     6   bear
  3     6     2   bear
  4     1     4   bear
  </code></pre>
  <p>Obviously, doing a <code>dplyr::mutate</code> command for each dataframe would take ages. I'm sure there's a way to do this with for loops and/or lapply but I don't have a good handle on how to use those functions. I also know that it's bad practice to have so many dataframes in my global environment; I'm all ears if you have suggestions for a more organized way of inputting this data to begin with (the data is coming from excel spreadsheets).</p>
  <p>The reason I'm doing this is I want to combine all these DFs into one DF. But if I just rbind immediately, I'll lose the important information that is in each DF's name. Thanks so much for your help.</p>