Greets, I'm trying to iteratively find solutions to a problem given a range of options. Code is as follows: sim.app.wald<-function(B=0.1,min=10,max=50,alpha=0.05){ result<-c(fails=0,n=0) for(n in min:max){ x<-seq(1,n-1,1) fhat<-x/n se<-sqrt((fhat*(1-fhat))/n) ci.wald<-fhat+qnorm(1-(alpha/2))*se if(sum(ci.wald[ci.wald<=B])){ # rbind(cbind(fails=x[ci.wald<=B],n=n),result) print(cbind(X=x[ci.wald<=B],n)) } # return(result) } } If you run it like this, you can readily see what I intend to get out; which is the correct result. If you uncomment the two commented lines, nothing useful obtains. What am I missing here? This seeming codependence of print() and return() and the failure of rbind() to do anything is quite puzzling. Best Regards, Steven [[alternative HTML version deleted]]