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

luke-tierney at uiowa.edu luke-tierney at uiowa.edu
Tue May 16 16:40:19 CEST 2017

On Tue, 16 May 2017, Serguei Sokol wrote:

> 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.

Yes: that is why I explicitly referenced the description at the top of
the page.

Changing the 'conceptually equivalent' bit to reflect what is
happening is easy.  The changes being discussed, and their long term
maintenance, ar not.



> Sergueï.

Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   luke-tierney at uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu

More information about the R-devel mailing list