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

David Winsemius dwinsemius at comcast.net
Wed May 26 18:05:56 CEST 2010


On May 26, 2010, at 11:58 AM, <mauede at alice.it> <mauede at alice.it> wrote:

> I am assigning subset of a matrix A [n,3]  where n>1  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]

Actually it becomes a vector. Look at it with str or is.matrix.


> rather than [1,3]
> How can I avoid this unwanted transpose operation ?

drop=FALSE

>
> THank you in advance,
> Maura
>


David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list