Hi Everyone,

I am merging two data frames that have different number of rows. But I end
up having rows a lot more than  both rows combined. I tried the following
but the duplicate bit does not change anything. Can anyone suggest to me
how I can handle this?

Regards,
Belay


x <-c(1, 2, 3, 4,5, NA, NA,NA,NA,10)
y <-c( NA, 4,NA,5,2, 10, 7, 1, 8, 9)
d<-1:10 #### this one belongs to the data frame a
d<-1:5 #### this one belongs to the data frame b
s1<-1:5
s2<-6:10

a<-data.frame(x,y,d)
b<- data.frame(s1,s2,d)

c<-merge(a, b, by=c("d"))

c[!duplicated(c[,c("x","y")]),]

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to