[R] permutation of the rows of a matrix that minimizes the distance to another matrix

Carlos Soares csoares at fep.up.pt
Thu Apr 24 15:36:55 CEST 2008


Hi!
I have 2 matrices of numbers m1 and m2 with the same number of columns 
and rows. I would like to compute m2', the permutation of the rows of m2 
such that the distance (e.g., sum(m1-m2') or sum((m1-m2')^2))  is 
minimized. Do you know of any function/algorithm to obtain such a 
permutation?
Best regards,
Carlos



More information about the R-help mailing list