Re: [R] 'all' inconsistent?

2006-01-31 Thread Bjørn-Helge Mevik
Seth Falcon wrote: On 29 Jan 2006, [EMAIL PROTECTED] 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

Re: [R] 'all' inconsistent?

2006-01-30 Thread Seth Falcon
On 29 Jan 2006, [EMAIL PROTECTED] 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

Re: [R] 'all' inconsistent?

2006-01-30 Thread Giovanni Petris
I thought all the values are false, all none of them, because there aren't any that are true: any(logical(0)) [1] FALSE This is for the same reason why a product over an empty set of factors is 1, and a sum over an empty set of terms is 0. GP --

Re: [R] 'all' inconsistent?

2006-01-30 Thread Uwe Ligges
Seth Falcon wrote: On 29 Jan 2006, [EMAIL PROTECTED] 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

Re: [R] 'all' inconsistent?

2006-01-30 Thread Seth Falcon
On 30 Jan 2006, [EMAIL PROTECTED] wrote: Current behaviour is consistent in so far that identical(all(x), !any(!x)) is TRUE and definition of any() is obvious. That helps, thanks. I'm not sure I've had enough coffee to continue, but, for the set analogy I think we are saying: logical(0) is

Re: [R] 'all' inconsistent?

2006-01-30 Thread Uwe Ligges
Seth Falcon wrote: On 30 Jan 2006, [EMAIL PROTECTED] wrote: Current behaviour is consistent in so far that identical(all(x), !any(!x)) is TRUE and definition of any() is obvious. That helps, thanks. I'm not sure I've had enough coffee to continue, but, for the set analogy I think we are

Re: [R] 'all' inconsistent?

2006-01-30 Thread Peter Dalgaard
Seth Falcon [EMAIL PROTECTED] writes: On 30 Jan 2006, [EMAIL PROTECTED] wrote: Current behaviour is consistent in so far that identical(all(x), !any(!x)) is TRUE and definition of any() is obvious. That helps, thanks. I'm not sure I've had enough coffee to continue, but, for the set

[R] 'all' inconsistent?

2006-01-29 Thread Elizabeth Purdom
Hello, I came across the following behavior, which seems illogical to me. I don't know if it is a bug or if I'm missing something: all(logical(0)) [1] TRUE any(logical(0)) [1] FALSE isTRUE(logical(0)) [1] FALSE This actually came up in practice when I did something like all( names(x)

Re: [R] 'all' inconsistent?

2006-01-29 Thread Gabor Grothendieck
I think the corresponding question was already discussed in the context of sum and in terms of this question one wants: all(x) all(y) to equal all(c(x,y)) including the case where x or y has zero length. On 1/30/06, Elizabeth Purdom [EMAIL PROTECTED] wrote: Hello, I came across the following

Re: [R] 'all' inconsistent?

2006-01-29 Thread Prof Brian Ripley
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. any(logical(0))