The value matching function in R is very useful. But from my understanding, it does not sufficiently support two or high dimensional inputs.
For examp
You could do that without using any functions:
Suppose adj1 is the 3*3 matrix with both colnames and row.names being c('V1','V2','V3') and vec1 is the order you want your matrix to be transformed into:
vec1 <- c('V2','V3','V1')
You could simply using the following code:
adj1[vec1,vec1]
Which will do you the magic.
Cheers!