Skip to content
Prev 246545 / 398502 Next

Match numeric vector against rows in a matrix?

On Jan 5, 2011, at 2:16 PM, Kevin Ummel wrote:

            
> intersect( which(combs[,1]==x[1]), which(combs[,2]==x[2]) )
[1] 3

Or maybe even faster:

 >  which( combs[,1]==x[1] & combs[,2]==x[2])
[1] 3