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"