[R] Vector to Matrix transformation

Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
Tue Jan 23 15:34:41 CET 2007


check the help page for ?matrix(); you probably want either

matrix(V1, nrow = 5)

or

matrix(V1, nrow = 5, byrow = TRUE)


I hope it helps.

Best,
Dimitris

----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
     http://www.student.kuleuven.be/~m0390867/dimitris.htm


----- Original Message ----- 
From: "Shubha Vishwanath Karanth" <shubhak at ambaresearch.com>
To: <r-help at stat.math.ethz.ch>
Sent: Tuesday, January 23, 2007 3:10 PM
Subject: [R] Vector to Matrix transformation


> Hi R,
>
>
>
> I have a vector V1 of unknown length, say n. I need to convert this 
> into
> a matrix C of row size=5, and accordingly the column should be 
> updated.
> I tried with:
>
>
>
> C=as.matrix(V1,5,n/5)
>
>
>
> But it is not working...Could somebody help me on this?
>
>
>
> Thanks in advance...
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



More information about the R-help mailing list