What’s the best practice for exiting C code on discovery of an error back to R? Package guidance says don’t use exit(), which makes sense (as you kill everything), but how do you exit to R and indicate an error has occurred. Obviously you could have an error flag in the return vector, but is there a better way?
What’s the best practice for exiting C code on discovery of an error back
Share
You’re looking for
error(). It’s described in Section 6.2 of Writing R Extensions… and you should listen to your subconscious more often. 😉