Is this what you are searching for? n.max <- 300 NUM <- 25 id<-0
n.sim <- 10 j <- (n.max/NUM)*n.sim results <- matrix(0, nrow=j, ncol=2) while(NUM <= n.max){ for(i in 1:n.sim){ k <- (NUM/25)*i id<-id+1 results[id,1] <- k results[id,2] <- NUM } NUM <- NUM + 25 } results <<< If not, plase give an example how you would like the results to look like! Best, Ales Ziberna -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Teresa Nelson Sent: Wednesday, January 04, 2006 4:44 PM To: r-help@stat.math.ethz.ch Subject: [R] Why doesn't this nested loop work? Hi there, I can get the for-loop to work, I can get the while loop to work. But I can't get a for loop to work nested within the while loop - why? Please help, Teresa ______________________________________________ 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