How to Apply the stopifnot() Function in R (Example Code)
In this article, I’ll show how to apply the stopifnot function to test for the truth of certain expressions in the R programming language.
How to Apply the stopifnot() Function to Test the Truth of Expressions
stopifnot("x" == "x", # Test if all expressions are TRUE length(1:3) > 2, 5 == 4) # Error: 5 == 4 is not TRUE |
stopifnot("x" == "x", # Test if all expressions are TRUE length(1:3) > 2, 5 == 4) # Error: 5 == 4 is not TRUE