I just found these two gems about debugging in R on r-help today (here is the thread):
1) posted by Thomas Lumley:
traceback()gets you a stack trace at the last error
options(warn=2)makes warnings into errors
options(error=recover)starts the post-mortem debugger at any error,
allowing you to inspect the stack interactively.
2) added by William Dunlap:
will start that same debugger at each warning.
I think these are very useful ideas to remember – thanks.
Cheers, and enjoy life.