[R] combine
Ashta
sewashm at gmail.com
Sun Mar 26 06:37:58 CEST 2017
Hi all,
I have more than two files and merge by a single column and preserve the
other columns.
Here is an example of two files
dat1 <- read.table(header=TRUE, text=' ID T1 T2
ID1 125 245
ID2 141 264
ID3 133 281')
dat2 <- read.table(header=TRUE, text=' ID G1 G2
ID2 25 46
ID4 41 64
ID5 33 81')
How do I get the following output?
ID T1 T2 G1 G2
ID1 125 245 0 0
ID2 141 264 25 46
ID3 133 281 0 0
ID4 0 0 41 64
ID5 0 0 33 81
Thank you.
[[alternative HTML version deleted]]
More information about the R-help
mailing list