Re: [R] Wired behavior of a 2-by-2 matrix indicies

2011-02-26 Thread Sarah Goslee
Hello, On Sat, Feb 26, 2011 at 12:11 PM, 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 "[",

[R] Wired behavior of a 2-by-2 matrix indicies

2011-02-26 Thread Feng Li
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 ca