Hi Im trying to merge 2 data frames using merge but I dont get the result i want
Lets make this a small test as my data set is to big to put in here :). t1<-data.frame(a=c(1,2,3,4,5,6),b=c(11,11,NA,11,11,11)) t1<-data.frame(a=c(1,2,3,4,5,8),b=c(12,12,12,12,12,32)) this gives me: > t1 a b 1 1 12 2 2 12 3 3 12 4 4 12 5 5 12 6 8 32 > t2 a b 1 1 11 2 2 11 3 3 NA 4 4 11 5 5 11 6 6 11 now when i merge i get: > merge(t1,t2, by="a") a b.x b.y 1 1 12 11 2 2 12 11 3 3 12 NA 4 4 12 11 5 5 12 11 But what I want is it to look like: a b.x b.y 1 1 12 11 2 2 12 11 3 3 12 NA 4 4 12 11 5 5 12 11 6 8 32 NA So I keep all of the rows from t1 and get an NA in dose slots at the t2 part of the merge. Anyone know how to accomplice this? Thx //Joel -- View this message in context: http://r.789695.n4.nabble.com/Prob-with-merge-tp3053652p3053652.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.