Daniel - Reduce may be handy here: ans = Reduce(function(a,b)merge(a,b,by=1),yoda) names(ans)[2:ncol(ans)] = names(yoda)
- Phil Spector Statistical Computing Facility Department of Statistics UC Berkeley spec...@stat.berkeley.edu On Tue, 9 Mar 2010, Daniel Brewer wrote:
Hello, I have for a long list of data.frames that I would like to get merged. Each data.frame have two columns with the same names (Date and Value). What I would like is for the objects in the list to be merged on Only date with the column header being the name in the list. For example A <- data.frame(Date=c("03/15/10","04/15/10","05/15/10"), Value=c(1,2,3)) B <- data.frame(Date=c("03/15/10","04/15/10","06/15/10"), Value=c(5,5,5)) ... yoda <- list(A=A,B=B,...) Result: Date A B C 03/15/10 1 5 ... 04/15/10 2 5 05/15/10 3 NA 06/15/10 NA 5 Any ideas? I have been fiddling around with plyr and reshape without success Thanks Dan -- ************************************************************** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis MUCRC 15 Cotswold Road Sutton, Surrey SM2 5NG United Kingdom Tel: +44 (0) 20 8722 4109 ************************************************************** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}} ______________________________________________ R-help@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.
______________________________________________ R-help@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.