Assume a matrix that contains all bit strings of length `r`

and is in order.

```
library(gtools)
mat<-permutations(n = 2, r = 5, v = c(0,1), repeats.allowed = TRUE)
mat<-cbind(mat, round(runif(nrow(mat)), digits = 2))
```

and several vectors each with `r`

elements:

```
r=5
vec<-t(replicate(100,sample(c(0,1),5,replace=T)))
```

For each vector (i.e, row in `vec`

) I would like to identify the corresponding row in `mat`

Note: I would like to list the result for each row, not just the `unique`

elements.

Is there an efficient way to do this without using a for loop?