Re: [R] How to split a single vector into a multiple-column and multiple-row matrix

From: Roger D. Peng <rpeng_at_jhsph.edu>
Date: Sat 26 Mar 2005 - 02:16:11 EST

You can use 'matrix()', as in

x <- 1:2000
matrix(x, nrow = 200, ncol = 10)

-roger

R_xprt_wannabe wrote:
> Dear List,
>
> I have, say, a 2000x1 numeric vector and would like to
> split it into, say, a 200x10 matrix. Any help is
> appreciated.
>
> ______________________________________________
> 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
>

-- 
Roger D. Peng
http://www.biostat.jhsph.edu/~rpeng/

______________________________________________
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
Received on Sat Mar 26 02:19:55 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:56 EST