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

Serguei Sokol sokol at insa-toulouse.fr
Tue May 16 11:37:10 CEST 2017


Le 15/05/2017 à 19:41, luke-tierney at uiowa.edu a écrit :
> This is getting pretty convoluted.
>
> The current behavior is consistent with the description at the top of
> the help page -- it does not promise to stop evaluation once the first
> non-TRUE is found.
Hm... we can read in the man page :
‘stopifnot(A, B)’ is conceptually equivalent to

       { if(any(is.na(A)) || !all(A)) stop(...);
         if(any(is.na(B)) || !all(B)) stop(...) }
and this behavior does promise to stop at first non-TRUE value
without evaluation of the rest of conditions.

Sergueï.



More information about the R-devel mailing list