The poster asked for row major representation, not column major
representation.

Matrices **are** vectors -- stored in column major order.
Try:

cat(x,"\n")  ## versus...
cat(t(x),"\n")

The tabular printout occurs because the print() method for a matrix object
(more generally any array) prints the matrix  (a vector with a dim
attribute) in an appropriate way. However you can manipulate the matrix
**as** a vector, and in most circumstances, the dim attribute will be
preserved so it will remain a matrix object.

Please read "An Introduction to R," ?methods and ?print (at least) for
details. R will always be arcane to those who do not make a serious effort
to learn it. It is **not** meant to be intuitive and easy for casual users
to just plunge into. It is far too complex and powerful for that. But the
rewards are great for serious data analysts who put in the effort.


Bert Gunter
Genentech Nonclinical Statistics


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Henrique Dallazuanna
Sent: Monday, August 06, 2007 7:33 AM
To: Niccolò Bassani
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Create vectors form matrices

Try:

dim(matrix) <- NULL

-- 
Henrique Dallazuanna
Curitiba-Parana-Brasil
250 25' 40" S 490 16' 22" O

On 06/08/07, Niccolr Bassani <[EMAIL PROTECTED]> wrote:
>
> Hi, dear R users. I've a kind of stupid question, I hope you can provide
> some help!
> The topic here's really simple: vectors and matrices.
> I have a matrix (616 rows x 22 cols) filled with numbers and NAs;
> something
> like this:
>
> 1  2  3  4  5  6  NA  NA NA NA ........
> 1  2  3  4  NA  NA  NA  NA NA .........
> ..................................................
> ................................................
>
> What I'm trying to do is to put all the rows on a unique row, so to have
> something like this:
>
> 1  2  3  4  5  6  NA  NA NA NA ........1  2  3  4  NA  NA  NA  NA NA
> .........
>
> and so on. The matter is that whatever I try, I just get something like
> this:
>
> 1 1 1 1 1 1 1 1 .........................2 2 2 2 2 2 2 2 2 ......
>
> Obviously, this is not what required. I've tried to concatenate, I've
> built
> a for cicle, but nothing seems to produce what I want. Sorry for the dumb
> question, but I'm almost sure I need holidays...
> Thanks in advance!
> niccolr
>
>         [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@stat.math.ethz.ch 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.

Reply via email to