Re: [R] What does uniroot return when an error occurs

2012-11-01 Thread William Dunlap
er 01, 2012 1:00 PM > To: r-help@r-project.org > Subject: [R] What does uniroot return when an error occurs > > Hi, > > I'm using the uniroot function, and would like to detect an error which > occurs, for instance, when the values at endpoints are not of opposite > si

[R] What does uniroot return when an error occurs

2012-11-01 Thread asafwe
Hi, I'm using the uniroot function, and would like to detect an error which occurs, for instance, when the values at endpoints are not of opposite signs. For example: uniroot( function(x) x^2+1, lower=1, upper=2 ). I want to say something like: if "error in uniroot(...)" return NA else return u