From: Adaikalavan Ramasamy <ramasamy_at_cancer.org.uk>

Date: Mon 08 Aug 2005 - 23:50:07 EST

}

}

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 Tue Aug 09 00:08:23 2005

Date: Mon 08 Aug 2005 - 23:50:07 EST

- If the output at each iteration gives a fixed number of elements, then you can pre-define the matrix. For example

mat <- matrix( NA, nr=6, nc=500 )

for(i in 1:500 ){

x <- rnorm(13) mat[ , i] <- summary(x)

}

2) If the length of the output varies at each iteration, then it is probably best to use a list.

mylist <- list(NULL)

for(i in 1:500){

x <- rpois(1, lambda=10) + 1 y <- rnorm(x) my.list[[ i ]] <- y

}

Regards, Adai

On Mon, 2005-08-08 at 12:34 +0200, Clark Allan wrote:

> hi all

*>
**> assume that one is doing a simulation. in each iteration one produces a
**> vector of results. this vectors length might change for each different
**> iteration. how can one construct a matrix that contains all of the
**> interation results in a matrix where each of the columns are the outputs
**> from the different interations.
**>
**> how would have to define the output matrix initally?
**>
**> /
**> thanking you in advance
**> ______________________________________________ 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
*

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 Tue Aug 09 00:08:23 2005

*
This archive was generated by hypermail 2.1.8
: Sun 23 Oct 2005 - 15:09:41 EST
*