Hi R-Gurus, 

I've been cutting along quite nicely with nlm, until
I threw in the following condition in the function that nlm is
minimising:

    if (((term*bexp) < 0.0001)) {
       #warning(term*bexp, "=term*bexp",psi,"=psi")     
       theta<-2000
    }



Now when I run this function anywhere else, there is no problem, whether
or the if's condition is met.

When I use this in nlm:

nlm(f=ssewrap.dist, p=c(292397.7,-.14053,0.03,.0005), .5, 1,
295.15,C,theta)
Error in if (((term * bexp) < 1e-04)) { : 
  missing value where TRUE/FALSE needed


Now I know that the condition in the if should only be one logical
value, but is not the condition above evaluated to a single value, and
why does the error only occur when the function is used by nlm?

Any suggestions?

Kind regards, 

Matt Redding
********************************DISCLAIMER**************...{{dropped:15}}

______________________________________________
R-help@r-project.org 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.

Reply via email to