Re: [R] Finding the maximum elements in an array/matrix

2012-03-29 Thread Jorge I Velez
Try which(A == max(A), arr.ind = TRUE) HTH, Jorge.- On Thu, Mar 29, 2012 at 10:27 PM, jpm miao <> wrote: > Hello, > > I would like to find the maximum element in a matrix or an array but it > does not return what I want. > > For example, If I have a 2*2 matrix A whose maximum element is th

Re: [R] Finding the maximum elements in an array/matrix

2012-03-29 Thread R. Michael Weylandt
As they say, RTFMin particular, this part: ? which.max --> See Also: Use ‘arrayInd()’, if you need array/matrix indices instead of 1D vector ones. Michael On Thu, Mar 29, 2012 at 10:27 PM, jpm miao wrote: > Hello, > >   I would like to find the maximum element in a matrix or an a

[R] Finding the maximum elements in an array/matrix

2012-03-29 Thread jpm miao
Hello, I would like to find the maximum element in a matrix or an array but it does not return what I want. For example, If I have a 2*2 matrix A whose maximum element is the A(1,2). I would like the answer (1,2), but it returns 3, which is the ordinal if one counts by columns. Is there any