I would point you at last.warning, but also note that it says this in
?warnings:
Warning:
It is undocumented where 'last.warning' is stored nor that it is
visible, and this is subject to change.
But it does seem like you could test if your warning was already in there, eg
mywarnings
This is not a complete answer to your problem, but here is an example of
how to make and store messages of a certain class, "lowMessage", and later
print a table of the messages and their counts.
> lowMessage <- function(text, call = sys.call(-1))
{
# make a message of class "lowMessage"
Dear All,
I have a package (ergm, in case you are wondering) that has some low-
level routines (say, low()) that produce messages that the end-user
needs to see and that tend to be called multiple times for every time
the top-level routine (say, high()) is called, often by other routines
that are