Suppose I have two matrices, each with two columns and differing numbers of row. I want to check and see which pairs of one matrix are in the other matrix. If these were one
Another approach would be:
> paste(a[,1], a[,2], sep="$$") %in% paste(x[,1], x[,2], sep="$$") [1] FALSE TRUE TRUE FALSE
A more general version of this is:
> apply(a, 1, paste, collapse="$$") %in% apply(x, 1, paste, collapse="$$") [1] FALSE TRUE TRUE FALSE