[R] an assert() function
Greg Minshall
minshall at umich.edu
Tue Feb 12 15:11:56 CET 2013
hi. i've looked for (and not found) an assert() function. needing one,
i created the following (from stop()). i'm posting it in case 1)
someone sees a problem with this; and 2) someone else has a need.
cheers, Greg
----
## an assert mechanism...
assert <- function (shouldbe, ...) {
if (!shouldbe) {
.Internal(stop(as.logical(TRUE),
.makeMessage("assertion failure: ", ..., domain = NULL)))
}
}
More information about the R-help
mailing list