[R] if statement error

Alberto Monteiro albmont at centroin.com.br
Tue Oct 17 19:34:17 CEST 2006


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



More information about the R-help mailing list