Do.Call, Rbind dataframe - add column name, and long to wide data
<p>I am analyzing data across 200 csv files. I have imported the files in R, and created a couple of different functions so that the result is such that it gives me the function (count and sum by color) result by each file. The function result is in the form of a data frame.<br>
For the final result, I am using a combination of do.call(rbind,result) which produces an output such as below: Since I am using rbind, the first column does not have a header.  </p>

<pre><code>          Count Sum
File1.Blue  5   10
File1.Red   2   6
File2.Blue  1   3
File2.Red   1   1
File3.Blue  4
File3.Red   7   2   
</code></pre>

<p>The list is very long. I want to transpose the result such that final results look like:  </p>

<pre><code>       Blue Count Blue Sum  Red Count   Red Sum
File 1      5       10      2       6
File 2      1       3       1       1
File 3      4       0       7       2
</code></pre>

<p>I think I need to use reshape or cast function…but I am not sure how to split the file names first and then arrange the data</p>