a****g 发帖数: 8131 | | a****u 发帖数: 95 | 2 How about using rbind first and aggregate
x<-matrix(1:10,ncol=2,byrow=TRUE)
y<-matrix(1:20,ncol=2,byrow=TRUE)
z<-rbind(x,y)
aggregate(z,by=list(z[,1],z[,2]),FUN=tail,1)
If only duplicate for one column need to be removed, can try use match and
rbind
index<-match(x[,1],y[,1])
rbind(x[-index,],y) | a****g 发帖数: 8131 | 3 thanks
i got it using aggregate.
【在 a****u 的大作中提到】 : How about using rbind first and aggregate : x<-matrix(1:10,ncol=2,byrow=TRUE) : y<-matrix(1:20,ncol=2,byrow=TRUE) : z<-rbind(x,y) : aggregate(z,by=list(z[,1],z[,2]),FUN=tail,1) : If only duplicate for one column need to be removed, can try use match and : rbind : index<-match(x[,1],y[,1]) : rbind(x[-index,],y)
| I*****a 发帖数: 5425 | 4 or use unique
【在 a****g 的大作中提到】 : thanks : i got it using aggregate.
|
|