@Nick:
You can control your error message if you write a function with a descriptive name to check for a condition that will cause an error in your program. Here is an example:
Less_Than_8 = function(x) return(x < 8) for (i in 1:10) { print(i) stopifnot(Less_Than_8(i)) }
This will print the numbers 1 to 8, and then print a message saying
Error: Less_Than_8(i) is not TRUE
It would be nice if the "i" in parentheses was replaced with a value that did not pass the test, but you get what you pay for.
If you need something more interesting, look at Runit and testthat, as Harlan suggested.
CCC Aug 25 2018-11-22T00: 00Z
source share