title: How to create a variable that indicate where the data from in every list elements in r
body: <p>My question is what I said in the title, and I found Duck's question same as mine (<a href="https://stackoverflow.com/questions/19623590/how-to-create-in-r-new-variable-for-each-element-in-a-list-of-data-frames-with-t">How to create in R new variable for each element in a list of data frames with the name of data frame and its value equal to position of the element</a>).</p>
  
  <p>Within my poor knowledge in R, I can't understand well the code though it really got what I wanted.</p>
  
  <p>I know my code can't run but I though the code should like this :</p>
  
  <pre><code># create a fake data
  df1 &lt;- split(mtcars,mtcars$cyl)
  
  # add a new variable that indicate where the element from in the list with the element name
  df2 &lt;- map(df1, mutate(from = names(df1)))
  
  </code></pre>
  
  <p>Any help will be highly appreciated!</p>