[R] creating an index vector within a 'for' loop

laura@bayesian-bay.freeserve.co.uk laura at bayesian-bay.freeserve.co.uk
Mon Jul 29 11:04:20 CEST 2002


Dear list

I have what is probably a very simple question that I can't seem to solve. I basically want to create a vector at the end of a 'for' loop that will store the output for each person and which I can recall after the loop has run. This will require some sort of indexing.

X and Y are matrices defined earlier for each person (within the for loop but I'm not writing it here to cut irrelevant information)

for (i in 1:10) {
XY[i]<-X%*%Y
}

Could someone tell me how I can create the matrix that will contain the output for each of the 10 people?

Many thanks in advance
Laura


_______________________________________________________________________




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