[R] saving warning messages

vito muggeo vito.muggeo at giustizia.it
Tue May 27 14:15:57 CEST 2003

Dear all,
is it possible to save warning messages in the object created by any
function causing the warning message itself?

For instance coxph() in survival package fits Cox regression model and
returns the fitted model with possible warning messages if some problems
occur in fitting. However sometimes the warning messages may be meaningless
and the fitted model to be valid at all.
Therefore I would like the warning msg to be attached in the returned
object, i.e. to have something like
obj<-coxph(.... #print warning message

Using par(warn=2) causes the warnings messages to be considered as error and
it is not what I want.

many thanks for your time,


More information about the R-help mailing list