Is there a fast way of finding which rows in matrix A are present in matrix B? e.g.

m1 = matrix(c(1:6), ncol=2, byrow = T); m2 = matrix(c(1:4), ncol=2, byrow=T);

and the result would be 1, 2.

The matrices do not have the same number of rows (number of columns is the same), and they are somewhat big - from 10^6 - 10^7 number of rows.

The fastest way of doing it, that I know of for now, is:

duplicated(rbind(m1, m2))

Tnx!

Edit
Report