Skip to content
Prev 131987 / 398506 Next

Flushing (Reset) 'last.warning'

Tiago R Magalh?es wrote:
One workaround:  when you want to clear the old warning, issue a blank 
one.  For example:

warning("")
prop.test(vec.1, total.1); collect[1] <- names(warnings())
warning("")
prop.test(vec.2, total.2); collect[2] <- names(warnings())
warning("")
prop.test(vec.1, total.1); collect[3] <- names(warnings())

This puts a lot of spurious lines like

Warning message:
 
into your output; you might prefer to use text like "Resetting warning 
message" instead of a blank.

Duncan Murdoch