Skip to content
Prev 177745 / 398502 Next

search through a matrix

onyourmark wrote:
Example:

# prepare example data:
x <- matrix((1:25) / 25, 5, 5)
rownames(x) <- letters[1:5]
colnames(x) <- letters[1:5]

# solution
cbind(rownames(x)[row(x)[x > 0.9]], colnames(x)[col(x)[x > 0.9]])


Uwe Ligges