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 you
have one column. If you transform it, you should do :
> matrix(B,ncol=3)
     [,1] [,2] [,3]
[1,]   10   20   30

Or use drop=F :

> C <- A[10,1:3,drop=F]
> C
     [,1] [,2] [,3]
[1,]   10   20   30
> is.matrix(C)
[1] TRUE


On Wed, May 26, 2010 at 5:58 PM, <mauede@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]
> rather than [1,3]
> How can I avoid this unwanted transpose operation ?
>
> THank you in advance,
> Maura
>
>
> tutti i telefonini TIM!
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Joris Meys
Statistical Consultant

Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control

Coupure Links 653
B-9000 Gent

tel : +32 9 264 59 87
Joris.Meys@Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php

	[[alternative HTML version deleted]]

