Skip to content
Back to formatted view

Raw Message

Message-ID: <42442B3B.1000600@jhsph.edu>
Date: 2005-03-25T15:16:11Z
From: Roger D. Peng
Subject: How to split a single vector into a multiple-column and	multiple-row matrix
In-Reply-To: <20050325151209.24016.qmail@web31315.mail.mud.yahoo.com>

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 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
> 

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