[R] Keeping track of occurrence of warning message

Laurent Gautier laurent at cbs.dtu.dk
Tue Jul 15 09:17:28 CEST 2003


On Tue, Jul 15, 2003 at 02:58:10PM +0800, Tan Chuen Seng wrote:
> Hi there,
> 
> I am interested if there is anyway to keep track of the occurrence of
> warning message. 
> 
> I know that warnings will only be printed out at the end of the program
> if warn=0. However I am also interested at which particular set of data
> does the warnings occur too. This is because I am running 1000 data, so
> if there are 2 or 3 data that give warnings, I would like to know which
> are the ones out of the 1000 data.
> 
> I tried using the following code in the program to indicate where the
> warning occur but was unable to get anything recorded although the
> warnings() gave me 12 messages.
> 
> track.warning<-NULL
> ....
> if(options("warn")$warn>=0){ 
> track.warning<-c(track.warning,data.no)
> }
> 
> 
> Your help is greatly appreciated. Thanks.
> 
> >From chuen seng
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help


One way to do things is to have a list to store warnings has you
hit them in you loop: you can access what is the list last.warning.



Hopin' it helps,



L.




More information about the R-help mailing list