Suppose I have the following matrix:
cm<-structure(c(100, 200, 400, 800, 100, 200, 400, 800, 100, 200, 400, 800, 100, 200, 400, 800, 100, 200, 400, 800,
The function row.match in prodlim is easy to use, and ideal for your problem.
row.match
prodlim
library(prodlim) row.match(a4[1,], cm[,1:3]) [1] 1