[R] Capturing coxph warnings and errors

From: Daniel Brewer <daniel.brewer_at_icr.ac.uk>
Date: Tue, 17 Jun 2008 15:47:40 +0100


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?



Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis Email: daniel.brewer_at_icr.ac.uk
The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}} ______________________________________________ R-help_at_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.
Received on Tue 17 Jun 2008 - 15:37:35 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 - 03:31:01 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive