Displaying 2 results from an estimated 2 matches for "idx4a".
2011 Feb 26
1
Wired behavior of a 2-by-2 matrix indicies
Dear R,
I found a very wired behavior for a 2-by-2 matrix, see this example
> A <- matrix(1:4, 2)
> idx4A <- matrix(1:4, 2)
> A[idx4A]
Error in A[idx4A] : subscript out of bounds
But other matrices are fine,
> B <- matrix(1:9, 3)
> idx4B <- matrix(1:9, 3)
> B[idx4B]
[1] 1 2 3 4 5 6 7 8 9
I can reproduce this for both 32bit windows and 64bit linux with R 2.12.1
and some earlier...
2011 Feb 26
0
Weird behavior of a 2-by-2 matrix indicies
...oslee <sarah.goslee@gmail.com>wrote:
> Hello,
>
> On Sat, Feb 26, 2011 at 12:11 PM, Feng Li <m@feng.li> wrote:
> > Dear R,
> >
> > I found a very wired behavior for a 2-by-2 matrix, see this example
> >
> >> A <- matrix(1:4, 2)
> >> idx4A <- matrix(1:4, 2)
> >> A[idx4A]
> > Error in A[idx4A] : subscript out of bounds
>
> This shouldn't work. From the help for "[",
>
> When indexing arrays by ā[ā a single argument āiā can be a
> matrix with as many columns as there are...