Re: [R] Problem whit a piece of program

From: Kevin E. Thorpe <kevin.thorpe_at_utoronto.ca>
Date: Fri 14 Oct 2005 - 00:48:44 EST

Arturo Coral Alamo wrote:
> Hi friends, I'm beginning in R and I have simple question.
>
> I have this piece of my program and how you see, that's ok (whit > num<-
> 0.002)
>
> num<-0.002 # ok, but not when I change whit num<-0... ?
> factor1<-1;
> while(1)
> {
> if (num*factor1<1)
> factor1<-factor1*10
> else
> {
> print("out ok!!");
> break;
> }
> }
>
> [1] "out ok!!"
>
>
> but when I change (whit > num<-0) R show this:

Since num==0, num*factor1 is always 0 and so the loop never terminates and factor1 grows without bound becoming Inf.

> Error in if (num * factor1 < 1) factor1 <- factor1 * 10 else { :
> missing value where TRUE/FALSE needed
>
>
> I can't understand that error, can somebody help me, please
> thanks in advance
> Jac

-- 
Kevin E. Thorpe
Biostatistician/Trialist, Knowledge Translation Program
Assistant Professor, Department of Public Health Sciences
Faculty of Medicine, University of Toronto
email: kevin.thorpe@utoronto.ca  Tel: 416.946.8081  Fax: 416.946.3297

______________________________________________
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
Received on Fri Oct 14 01:06:04 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 18:50:23 EST