Pele
2009-Mar-08 20:23 UTC
[R] Merge 10 data frames with 3 id columns that are common to all data frames
Hi R users, Can anyone share some example code using merge_all (from the reshape package) to merge 10 data frames into 1 file. Thanks in advance for any help! -- View this message in context: http://www.nabble.com/Merge-10-data-frames-with-3-id-columns-that-are-common-to-all-data-frames-tp22402493p22402493.html Sent from the R help mailing list archive at Nabble.com.
baptiste auguie
2009-Mar-08 20:38 UTC
[R] Merge 10 data frames with 3 id columns that are common to all data frames
Hi, Try this:> DF1 <- data.frame(var1 = letters[1:5], x = rnorm(5), y =2) > DF2 <- data.frame(var1 = letters[3:7], x = rnorm(5), y=3) > DF3 <- data.frame(var1 = letters[6:10], x = rnorm(5), y=0) > # ... DF10 if you wish > > ( result <- merge_all(list(DF1, DF2, DF3) )) > > save( result, file ="merged.rda")I didn't know of this function, thanks. Similar solutions using base functions were proposed recently on http://wiki.r-project.org/rwiki/doku.php?id=tips:data-frames:merge and i've now added this for reference. baptiste On 8 Mar 2009, at 20:23, Pele wrote:> > Hi R users, > > Can anyone share some example code using merge_all (from the reshape > package) to merge 10 data frames into 1 file. > > Thanks in advance for any help! > -- > View this message in context: http://www.nabble.com/Merge-10-data-frames-with-3-id-columns-that-are-common-to-all-data-frames-tp22402493p22402493.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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