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
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
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
3 matches
Mail list logo