From sokol at insa-toulouse.fr  Tue May 16 11:37:10 2017
From: sokol at insa-toulouse.fr (Serguei Sokol)
Date: Tue, 16 May 2017 11:37:10 +0200
Subject: [Rd] stopifnot() does not stop at first non-TRUE argument
In-Reply-To: <alpine.LFD.2.20.1705151236510.27291@itasca.stat.uiowa.edu>
References: <64acdaeb-2857-9017-68c9-9da08e29a617@fredhutch.org>
 <E5DADF15-58C6-4F73-BC56-C6404896982F@gmail.com>
 <c2b3cb22-90bd-5372-e8b9-d1ea8b2ab828@fredhutch.org>
 <8945f7e4-99ce-53fa-46ee-cce64078a6a8@fredhutch.org>
 <22809.26921.473223.395550@stat.math.ethz.ch>
 <8fdb66b1-f785-ed55-6e40-a4ef8138e637@insa-toulouse.fr>
 <26bd9210-e40c-0967-7abb-5f724b09c034@insa-toulouse.fr>
 <22809.44830.153073.675527@stat.math.ethz.ch>
 <477f9e1a-4f7c-a902-e744-da4a36eb5a4f@insa-toulouse.fr>
 <22809.52422.219712.66882@stat.math.ethz.ch>
 <alpine.LFD.2.20.1705151236510.27291@itasca.stat.uiowa.edu>
Message-ID: <495de2cf-1633-e3bf-8c61-5f30029399e6@insa-toulouse.fr>

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



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