[R] 'all' inconsistent?

From: Elizabeth Purdom <epurdom_at_stanford.edu>
Date: Mon 30 Jan 2006 - 16:43:04 EST


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) %in% vec )

as an error-handling, and I was hoping that it would work regardless of whether x had names or not. I can clearly work around it, but it seemed like strange behavior to me.
Thanks,
Elizabeth Purdom
R 2.2.1, Windows XP



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 Mon Jan 30 16:50:45 2006

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