[R] A list of data.frames merged together

Daniel Brewer daniel.brewer at icr.ac.uk
Tue Mar 9 17:21:55 CET 2010


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}}



More information about the R-help mailing list