Not pretty, but here is a way to implement an exit()
command in R which works for me.
exit <- function() {
.Internal(.invokeRestart(list(NULL, NULL), NULL))
}
print("this is the last message")
exit()
print("you should not see this")
Only lightly tested, but when I run this, I see this is the last message
and then the script aborts without any error message.