last_warnings() and last_messages() return a list of all warnings and messages that occurred during the last R command.

global_entrace() must be active in order to log the messages and warnings.

By default the warnings and messages are printed with a simplified backtrace, like last_error(). Use summary() to print the conditions with a full backtrace.

last_warnings(n = NULL)

last_messages(n = NULL)



How many warnings or messages to display. Defaults to all.


if (FALSE) { global_entrace() f <- function() { warning("foo"); g() } g <- function() { warning("bar", immediate. = TRUE); h() } h <- function() warning("baz") f() # Simplified backtraces last_warnings() # Full backtraces summary(last_warnings()) }