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]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.