Skip to content
Prev 53404 / 63424 Next

stopifnot() does not stop at first non-TRUE argument

The first line of stopifnot is

    n <- length(ll <- list(...))

which takes ALL arguments and forms a list of them. This implies evaluation, so explains the effect that you see.

To do it differently, you would have to do something like 

   dots <- match.call(expand.dots=FALSE)$...

and then explicitly evaluate each argument in turn in the caller frame. This amount of nonstandard evaluation sounds like it would incur a performance penalty, which could be undesirable.

If you want to enforce the order of evaluation, there is always

   stopifnot(A)
   stopifnot(B)

-pd

  
    

Thread (22 messages)

Hervé Pagès stopifnot() does not stop at first non-TRUE argument May 2 Peter Dalgaard stopifnot() does not stop at first non-TRUE argument May 3 Hervé Pagès stopifnot() does not stop at first non-TRUE argument May 3 Hervé Pagès stopifnot() does not stop at first non-TRUE argument May 3 Martin Maechler stopifnot() does not stop at first non-TRUE argument May 15 Serguei Sokol stopifnot() does not stop at first non-TRUE argument May 15 Serguei Sokol stopifnot() does not stop at first non-TRUE argument May 15 Martin Maechler stopifnot() does not stop at first non-TRUE argument May 15 Peter Dalgaard stopifnot() does not stop at first non-TRUE argument May 15 Serguei Sokol stopifnot() does not stop at first non-TRUE argument May 15 Martin Maechler stopifnot() does not stop at first non-TRUE argument May 15 Peter Dalgaard stopifnot() does not stop at first non-TRUE argument May 15 Martin Maechler stopifnot() does not stop at first non-TRUE argument May 15 Serguei Sokol stopifnot() does not stop at first non-TRUE argument May 15 Luke Tierney stopifnot() does not stop at first non-TRUE argument May 15 Hervé Pagès stopifnot() does not stop at first non-TRUE argument May 15 Hervé Pagès stopifnot() does not stop at first non-TRUE argument May 15 Martin Maechler stopifnot() does not stop at first non-TRUE argument May 16 Serguei Sokol stopifnot() does not stop at first non-TRUE argument May 16 Luke Tierney stopifnot() does not stop at first non-TRUE argument May 16 Luke Tierney stopifnot() does not stop at first non-TRUE argument May 16 Martin Maechler stopifnot() does not stop at first non-TRUE argument May 16