[R] how to avoid a subset of a matrix to become a column vector

2010-05-26 Thread mauede
I am assigning subset of a matrix A [n,3] where n1 to a temporary matrix TMP I do not know how many rows of A will be assigned to TMP because this is established by a run-time test. I expect TMP to be a matrix [m,3], m =1 But when 1 row only is transferred from A to TMP then TMP becomes [3,1]

Re: [R] how to avoid a subset of a matrix to become a column vector

2010-05-26 Thread David Winsemius
On May 26, 2010, at 11:58 AM, mau...@alice.it mau...@alice.it wrote: I am assigning subset of a matrix A [n,3] where n1 to a temporary matrix TMP I do not know how many rows of A will be assigned to TMP because this is established by a run-time test. I expect TMP to be a matrix [m,3], m

Re: [R] how to avoid a subset of a matrix to become a column vector

2010-05-26 Thread Joris Meys
What exactly are you trying to do? An example (which you should have provided) A - matrix(1:100,nrow=10,ncol=10) B - A[10,1:3] B [1] 10 20 30 is.matrix(B) [1] FALSE matrix(B) [,1] [1,] 10 [2,] 20 [3,] 30 This is logic, as you convert a vector to a matrix, and he will assume