[R] saving warning messages

Spencer Graves spencer.graves at pdf.com
Tue May 27 16:08:25 CEST 2003


?warnings in R1.6.2 reveals that, "`warnings' prints the top-level 
variable `last.warning' in a pleasing form."

hth.  spencer graves

vito muggeo wrote:
> 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
> is.null(obj$warning)
> 
>>FALSE
> 
> 
> 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,
> 
> vito
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help




More information about the R-help mailing list