Re: [R] matrix element position: from length to dim

2012-02-02 Thread R. Michael Weylandt
Also take a look at the arrayInd() function which is what's used by which() internally for the arr.ind = TRUE case. Michael On Thu, Feb 2, 2012 at 8:25 AM, Petr Savicky wrote: > On Thu, Feb 02, 2012 at 02:08:37PM +0100, Ana wrote: >> How can I pass from position in length inside a matrix to posi

Re: [R] matrix element position: from length to dim

2012-02-02 Thread Petr Savicky
On Thu, Feb 02, 2012 at 02:08:37PM +0100, Ana wrote: > How can I pass from position in length inside a matrix to position in dim ? > > > a=matrix(c(1:999),nrow=9) > > which(a==87)#position in length 1:length(a) > 87 > > which(a==87,arr.ind=TRUE) #position in dim > row col > [1,] 6

[R] matrix element position: from length to dim

2012-02-02 Thread Ana
How can I pass from position in length inside a matrix to position in dim ? a=matrix(c(1:999),nrow=9) which(a==87)#position in length 1:length(a) 87 which(a==87,arr.ind=TRUE) #position in dim row col [1,] 6 10 __ R-help@r-project.org ma