Okay, here is a more complete example: sample_sizes<- matrix(c(10,10,10,25,25,25,25,50,25,100,50,25,50,100,100,25,100,100), nrow=2) # see what it looks like sample_sizes ssds<-c(4,4.4,5,6,8) nssds<-length(ssds) results<-list() # first loop steps through the sample for(ss in 1:dim(sample_sizes)[2]) { # get the two sample sizes ss1<-sample_sizes[1,ss] ss2<-sample_sizes[2,ss] then step through your SDs: ssd_index<-1 for(ssd in ssds) { # generate the two samples with the SDs sample1<-rnorm(ss1,ssd) sample2<-rnorm(ss2,ssd) # here run your tests, recording the results that you want results[[(ss-1)*nssds+ssd_index]]<-<your_test> ssd_index<-ssd_index+1 } }
The list "results" should now contain the results of whatever test you run. Be careful to get the order right. Jim On Tue, Apr 5, 2016 at 8:07 PM, tan sj <sj_style_1...@outlook.com> wrote: > hi, Jim, > i am not very clear about yours idea. > How can i able to test them under the combination of factors? > I am now trying to do three for loops....but i am stucking .... > Please, I need help .... > ________________________________________ ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.