> Martin Maechler
> on Mon, 13 Apr 2020 22:30:35 +0200 writes:
> William Dunlap
> on Mon, 13 Apr 2020 09:57:11 -0700 writes:
>> You can avoid the problem in Martin's example by only giving scalars to
>> stopifnot(). E.g., using stopifnot(all(x>0)) or
> William Dunlap
> on Mon, 13 Apr 2020 09:57:11 -0700 writes:
> You can avoid the problem in Martin's example by only giving scalars to
> stopifnot(). E.g., using stopifnot(all(x>0)) or stopifnot(length(x)==1,
x> 0) instead of stopifnot(x>0). I think having stopifnot
You can avoid the problem in Martin's example by only giving scalars to
stopifnot(). E.g., using stopifnot(all(x>0)) or stopifnot(length(x)==1,
x>0) instead of stopifnot(x>0). I think having stopifnot call
all(predicate) if length(predicate)!=1 was probably a mistake.
Bill Dunlap
TIBCO Software
On 4/13/20 05:30, Martin Maechler wrote:
peter dalgaard
on Mon, 13 Apr 2020 12:00:38 +0200 writes:
> Inline...
>> On 13 Apr 2020, at 11:15 , Martin Maechler
wrote:
>>
>>> Bert Gunter
>>> on Sun, 12 Apr 2020 16:30:09 -0700 writes:
>>
>>>
> peter dalgaard
> on Mon, 13 Apr 2020 12:00:38 +0200 writes:
> Inline...
>> On 13 Apr 2020, at 11:15 , Martin Maechler
wrote:
>>
>>> Bert Gunter
>>> on Sun, 12 Apr 2020 16:30:09 -0700 writes:
>>
>>> Don't know if this has come up before, but
Inline...
> On 13 Apr 2020, at 11:15 , Martin Maechler wrote:
>
>> Bert Gunter
>>on Sun, 12 Apr 2020 16:30:09 -0700 writes:
>
>> Don't know if this has come up before, but ...
>>> x <- c(0,0)
>>> length(x)
>> [1] 2
>> ## but
>>> stopifnot(length(x))
>> Error: length(x) is not TRUE
> Bert Gunter
> on Sun, 12 Apr 2020 16:30:09 -0700 writes:
> Don't know if this has come up before, but ...
>> x <- c(0,0)
>> length(x)
> [1] 2
> ## but
>> stopifnot(length(x))
> Error: length(x) is not TRUE
> Called from: top level
> ## but
>>
Don't know if this has come up before, but ...
> x <- c(0,0)
> length(x)
[1] 2
## but
> stopifnot(length(x))
Error: length(x) is not TRUE
Called from: top level
## but
> stopifnot(length(x) > 0) ## not an error; nor is
> stopifnot(as.logical(length(x)))
## Ouch!
Maybe the man page should say
8 matches
Mail list logo