[R] warning.expression?

Henrik Bengtsson hb at maths.lth.se
Fri Sep 23 14:38:43 CEST 2005


Roger D. Peng wrote:
> You might be interested in 'tryCatch' to catch warnings.

A warning here: tryCatch(expr, warning=...) will catch warnings and 
interrupt 'expr' (as if an error occured), whereas 
withCallingHandlers(expr, warning=...) does not do this.

/Henrik

> -roger
> 
> Thomas Friedrichsmeier wrote:
> 
>>Hi!
>>
>>I'm trying to catch all warning-messages for special handling. It seems 
>>options (warning.expression=myfunc ()) can be used for that. However, the 
>>question is: How can I get at the actual warning in myfunc ()? Apparently in 
>>S, you can use .C("get_last_message") for that. Is there a similar mechanism 
>>in R?
>>
>>Thanks for your help!
>>Thomas
>>
>>______________________________________________
>>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
>>
> 
>




More information about the R-help mailing list