Hello,
I want to create a matrix of N random numbers with a uniform distributions.
Later, I want to repeat T times each row of this matrix. For this I do the
following loop:
N<-45
T<-10
n<-N*T
a<-matrix(runif(N,min=-1,max=1),nr=N)
mymat<-matrix(rep(NA,n),nr=n,nc=1)
for(i in i:N){
b<-rep(a[i,],T)
mymat[i,]<-b
}
Mi problem is that with this loop I can see the output of the loop but I canot
get the matrix (mymat) that contains the full output of the loop.
Please, somebody know how can I create a matrix that contains the output of the
loop with a dimension NTx1 (450x1).
Thanks a lot for your help.
Alexandra
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.