Re: [R] Looping help

2015-07-31 Thread Jim Lemon
Hi April, You need nested loops for something like this qs<- c(0,0.25,0.5,1,2,4,8,16,32,64) nrows<-dim(Data)[1] nqs<-length(qs) D.mat<-SE.mat<-matrix(NA,nrow=nrows,ncol=nqs) for(row in 1:nrows) { for(qval in 1:nqs) { # perform your calculation and set D.mat[row,qval] and SE.mat[row,qval] to the

Re: [R] Looping help

2015-07-30 Thread PIKAL Petr
Hi Your question is a bit cloudy. Simple loop can be realised to populate lists res<-vector(100, "list") for (i in 1:100) { lll <- do something based on i value res[[i]] <- put lll in ith place of the list } Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-pro