Skip to content
Prev 256974 / 398506 Next

extract cells by columns/rows from matrix

which(data==max(data),arr.ind=TRUE)

gives you the indices of the largest element.

which(data==data[order(data)[2]],arr.ind=TRUE)

the indices of the second largest.

Best
Jannis
On 04/14/2011 10:23 PM, Nicolas Gutierrez wrote: