I would like to order and convert the matrix values ββfrom the largest to the smallest, as in this simple and reproducible example:
#From : d<- c(-2,-34,25,0,13,0,25,-2,1) m<- matrix(d,3,3) m [,1] [,2] [,3] [1,] -2 0 25 [2,] -34 13 -2 [3,] 25 0 1 # To: m1 [,1] [,2] [,3] [1,] 5 4 1 [2,] 6 2 5 [3,] 1 4 3 #25: biggest number therefore -->(1) #13: second biggest one ---> (2) # ecc ... #-34: the smallest one ---> (6)
Any help? Thanks
source share