title: Adding columns from rowwis dataframe into do command
body: <p>I have a <code>data.frame</code> with file names and my plan is to read each <code>data.frame</code> to get one huge <code>data.frame</code>, but I want to have an extra column with the file names.</p>
  <p>What I do is going <code>rowwise</code> through the <code>data.frame</code> and use <code>do</code> to read the file and I try to attach the columns with <code>mutate</code>.</p>
  <pre><code>df &lt;- data.frame(a=c('file1.txt','file2.txt'), 
                   b=LETTERS[1:2], 
                   stringsAsFactors=FALSE)
  write.table(data.frame(c=runif(5), d=runif(5)), 
              'file1.txt', sep='\t', row.names=F)
  write.table(data.frame(c=runif(5), d=runif(5)), 
              'file2.txt', sep='\t', row.names=F)
  df %&gt;%
    rowwise() %&gt;%
    do(
      read.delim(.$a, stringsAsFactors=FALSE) %&gt;%
        mutate(A=.$a,
               B=.$b)
    )
  </code></pre>
  <p>For some reason, the attached columns are not <code>rowwise</code> attached as I would expect.</p>
  <p>Is there a solution doing it like this?</p>
  <h2 id="edit">Edit</h2>
  <p>Thanks to @Matteos answer, with nesting it works like a charm! I can now clearly see from which file the  rows come from.</p>
  <pre><code>df %&gt;%
    rowwise() %&gt;%
    mutate(x=list(read.delim(a, stringsAsFactors=FALSE))) %&gt;%
    tidyr::unnest(x)
  </code></pre>