[R] how to merge list of dataframes?
baptiste auguie
ba208 at exeter.ac.uk
Mon Dec 15 16:14:12 CET 2008
have you tried do.call(rbind, aa) , or perhaps do.call(merge, aa) ?
Hope this helps,
baptiste
On 15 Dec 2008, at 13:23, 江文恺 wrote:
>
> Dear all:
>
> I have a list of dataframes like this, i try to merge this lists of
> dataframes into one single dataframe, and keep ther column names as
> usual, how can i do this?
>
> i try lapply(aa,rbind), but it dose not work.
>
> Best regard!
>
>> summary(aa)
> Length Class Mode
> [1,] 3 data.frame list
> [2,] 3 data.frame list
> [3,] 3 data.frame list
> [4,] 3 data.frame list
> [5,] 3 data.frame list
> [6,] 3 data.frame list
> [7,] 3 data.frame list
> ...
>
>> aa[1]
> [[1]]
> b p d
> 1 1 pair1 1.07293
> 2 1 pair2 1.74022
> 3 1 pair3 4.17572
> 4 1 pair4 1.52449
> 5 1 pair5 1.63937
> 6 1 pair6 4.36470
> 8 1 pair8 1.17507
> 10 1 pair10 0.41672
> 11 1 pair11 3.62334
>
>> aa[2]
> [[1]]
> b p d
> 13 2 pair13 1.12680
> 14 2 pair14 1.41834
> 15 2 pair15 1.94462
> 16 2 pair16 4.97495
> 17 2 pair17 2.49566
> 18 2 pair18 6.76947
> 19 2 pair19 1.81448
> 20 2 pair20 6.25511
>
>> aa[3]
> [[1]]
> b p d
> 21 3 pair21 2.67789
> 22 3 pair22 1.57610
> 24 3 pair24 0.63215
> 25 3 pair25 0.79549
> 26 3 pair26 1.71219
> 27 3 pair27 39.29264
>
>
> _________________________________________________________________
> [[elided Hotmail spam]]
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
_____________________________
Baptiste Auguié
School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK
Phone: +44 1392 264187
http://newton.ex.ac.uk/research/emag
More information about the R-help
mailing list