Re: [R] Capturing coxph warnings and errors

From: Stephen Weigand <>
Date: Tue, 17 Jun 2008 21:07:17 -0500

On Tue, Jun 17, 2008 at 9:47 AM, Daniel Brewer <> wrote:
> Hi,
> I have a script that takes a subset of genes on a microarray and tries
> to fit a coxph model to the expression values for each gene. This seems
> to work fine but in some cases it produces warnings and/or errors.
> For example:
> Error in fitter(X, Y, strats, offset, init, control, weights = weights, :
> NA/NaN/Inf in foreign function call (arg 6)
> In addition: Warning message:
> In fitter(X, Y, strats, offset, init, control, weights = weights, :
> Ran out of iterations and did not converge
> In this situation I would like to:
> 1) Deal with it so that it the scripts result data.frame the p value etc
> are set to NA.
> 2) Suppress the Error and Warning messages
> What is the best way to do this?

Perhaps look at try() and look at the help for options() which explains different ways to handle warnings and errors. mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Wed 18 Jun 2008 - 02:09:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 18 Jun 2008 - 02:31:48 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive