[R] From "list" to "matrix"

Patrick Connolly p_connolly at slingshot.co.nz
Sun Jul 5 22:10:52 CEST 2009


On Sun, 05-Jul-2009 at 12:10PM -0700, megh wrote:

|> 
|> Suppose, I have following 
|> 
|> vec <- vector("list", length=3)
|> for (i in 1:3) vec[[i]] <- matrix(rnorm((i+3)*2), (i+3))
|> vec
|> 

do.call("rbind", vec)




|> 
|> Now I want to change the type of "vec" from list to a matrix with (4+5+6)
|> rows and 2 columns. How can I do that?
|> 
|> Thanks and regards,
|> -- 
|> View this message in context: http://www.nabble.com/From-%22list%22-to-%22matrix%22-tp24345922p24345922.html
|> Sent from the R help mailing list archive at Nabble.com.
|> 
|> ______________________________________________
|> R-help at 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.

-- 
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
   ___    Patrick Connolly   
 {~._.~}                   Great minds discuss ideas    
 _( Y )_  	         Average minds discuss events 
(:_~*~_:)                  Small minds discuss people  
 (_)-(_)  	                      ..... Eleanor Roosevelt
	  
~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.




More information about the R-help mailing list