Find the largest values on a matrix in R
问题 I am working on a matrix in R, 230 x 230 and I want to extract the 10 (or any other number than 1) max inputs on the matrix, both their position and value. The extra problem is that this is a similarity matrix, so I have 1s in the diagonal which of course I want to leave out of the max search. Any ideas or commands for that? 回答1: A neat way to do this in general is with the underused arrayInd function, which gives you row and column positions for plain jane vector positions. That's how which(