Thank you all for the advice here. I followed the suggestion that check the output of the parameters, and found that there might be two possibilities to cause the problem. First was there was missing value in real.d / real.b; the second was when beta2 was NA. I fixed the data set and the error no longer shows up.
Thank you very much! Jen -----Original Message----- From:Alberto Monteiro , [EMAIL PROTECTED] Sent: 2006-10-17, 11:36:40 To: r-help@stat.math.ethz.ch CC: Subject: Re: [R] if statement error Jenny Stadt wrote: > > I was not able to make this work. I know it is a simple one, sorry > to bother. Give me some hints pls. Thanks! > Are you a C programmer? :-) > if(length(real.d) >=30 && length(real.b) >=30 && > beta1*beta2*theta1*theta2 >0 ) > > { r <- 1; corr <- 1; } > I _think_ you should use & instead of &&. And drop the second ";". Also, don't forget that "return x" is wrong [it took me a long time to figure out that R != C, and it's just return(x)] Alberto Monteiro ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] ______________________________________________ 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 and provide commented, minimal, self-contained, reproducible code.