I have a matrix object that looks like the matrix below. It is a distance matrix between localities, but I need to sort them according to another order, something like CLR, LAG, CDA, ANT, CLC. I read some solutions with plyr with they didn't work in my case.
    ANT     CDA     CLC     CLR     LAGM
ANT 0.00    6.45    9.25    6.76    5.41
CDA 6.45    0.00    6.32    4.65    5.31
CLC 9.25    6.32    0.00    6.93    5.91
CLR 6.76    4.65    6.93    0.00    6.76
LAG 5.41    5.31    5.91    6.76    0.00
desired output (with the correct distances)
     CLR    LAGM    CDA ANT CLC
CLR                 
LAG                 
CDA                 
ANT                 
CLC                 
 
     
    