Re: [R] 'all' inconsistent?

From: Uwe Ligges <ligges_at_statistik.uni-dortmund.de>
Date: Tue 31 Jan 2006 - 02:22:20 EST

Seth Falcon wrote:

> On 29 Jan 2006, ripley@stats.ox.ac.uk wrote:
>
>

>>On Sun, 29 Jan 2006, Elizabeth Purdom wrote:
>>
>>
>>>I came across the following behavior, which seems illogical to me.
>>
>>What did you expect and why?
>>
>>
>>>I don't know if it is a bug or if I'm missing something:
>>>
>>>
>>>>all(logical(0))
>>>
>>>[1] TRUE
>>
>>All the values are true, all none of them.

>
>
> I thought all the values are false, all none of them, because there
> aren't any that are true:
>
> any(logical(0))
> [1] FALSE
>
> I can see how someone might expect an error, or NA, or FALSE in the
> above two cases. It is harder for me to see when all(logical(0))
> being TRUE would be useful.

Current behaviour is consistent in so far that identical(all(x), !any(!x)) is TRUE and definition of any() is obvious.

Uwe

>
> glass-is-half-emptily-yours,
>
> + seth
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jan 31 02:42:04 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:15 EST