[R] Sorted index of values in matrix

Eliza Botto e||z@_botto @end|ng |rom out|ook@com
Fri Apr 15 16:53:36 CEST 2022


deaR useRs,

I have this following simple dataset

> dput(qq)

structure(1:6, .Dim = 3:2, .Dimnames = list(c("1", "2", "3"),
    c("1", "2")))

I want to extract row and column index of the sorted values of this matrix

For example,

sort(qq) command will execute the sorted values of this matrix as (1 2 3 4 5 6). Instead of values, I want the row and column names of these sorted values as (1,1), (1,2), (1,3), (2,1), (2,2), (2,3)

I thankyou very much in advance for your help.

Eliza


	[[alternative HTML version deleted]]



More information about the R-help mailing list