[R] Problems with rbind

Winfried Theis theis at statistik.uni-dortmund.de
Tue Sep 10 15:04:11 CEST 2002


Dear Laura,

if all your vectors are of the same length, you can simply make a data.frame
from your list and then you can easily construct submatrices by the usual
subsetting methods. E.g.:

data <- as.data.frame(row.list) 
 # Here you have a data.frame with your rows as variables
h <- as.matrix(t(data[,1:3])) 
 # this should be the matrix you wanted in your example

But if you need your data as matrix, you might like to construct it straight
away:

mat <- matrix(nrow=n,ncol=k)
for(i in 1:n) mat[i,]<-rnorm(k)

Hope this helps,

Winfried

---------------------------------------------------------------------
E-Mail: Winfried Theis <theis at statistik.uni-dortmund.de>
Date: 10-Sep-02

Dipl.-Math. Winfried Theis
SFB 475, Fachbereich Statistik, Universit"at Dortmund, 44221 Dortmund
Tel.: +49-231-755-5903 FAX: +49-231-755-4387
----------------------------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list