Re: [R] print and rbind within a for loop

2015-03-25 Thread Steven LeBlanc
Hi Dave, Bill, Thank you. That was it! Best Regards, Steven On Mar 25, 2015, at 1:11 PM, David R Forrest wrote: > I'm away from a computer that can check syntax, but make sure the return is > outside of the for loop. To my eye it looks inside. [[alternative HTML version deleted]]

Re: [R] print and rbind within a for loop

2015-03-25 Thread William Dunlap
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) ... return(result) # indent! see what's wrong? } } Make your indentation (of the return line) correspond to the braces

Re: [R] print and rbind within a for loop

2015-03-25 Thread Steven LeBlanc
Hi Dave, Thank you, but that didn't seem to do it. This code produces the same result: 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