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]]
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
Try do.call("rbind", aa) HTH, Thierry ---------------------------------------------------------------------------- ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 Thierry.Onkelinx op inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -----Oorspronkelijk bericht----- Van: r-help-bounces op r-project.org [mailto:r-help-bounces op r-project.org] Namens ??? Verzonden: maandag 15 december 2008 14:23 Aan: r-help op r-project.org Onderwerp: [R] how to merge list of dataframes? 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 op 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. Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document.