[R] Problem with try()

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jul 5 11:12:48 CEST 2006

The problem here seems to be that the C code you are using does not return 
to R.  If so, it is nothing to do with try(), and you need to modify the 
way you are calling gsl to use a different error handler.

BTW, this seems much more appropriate to R-devel (see the posting guide).

On Mon, 3 Jul 2006, Landsman Leonid wrote:

> Dear R-experts,
> I am running a large simulation exercise where the enough complicated integration is required.
> The integral is computed within a C-function called Denom by use of function qags from the gsl library.
> Here is a piece of R-code:
>        denom<-try(.C("Denom",as.double(x),as.integer(n), as.integer(p),
>        as.double(param), as.double(delta),res=as.double(results)))
>        denomres=if (class(denom)=="try-error") NA else denom$res
> Sometimes, it happens that the integration process fails with the follwoing error message
> gsl: qags.c:553: ERROR: bad integrand behavior found in the integration interval
> Default GSL error handler invoked.
> and the whole simulation job is destroyed. My question is: why try() does not work and how to fix this problem?
> Much thanks,
> Leonid Landsman.
> 	[[alternative HTML version deleted]]
> ______________________________________________
> R-help at 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

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-help mailing list