[BioC] Inconistent behavior with all/any and Rle
Martin Morgan
mtmorgan at fhcrc.org
Tue Oct 12 06:16:22 CEST 2010
On 10/11/2010 07:55 PM, Steve Lianoglou wrote:
> Hi,
>
> I'm not sure what this should actually return. I think I was surprised
> that it returned TRUE:
>
> R> all(Rle(rep(FALSE, 0)))
> [1] TRUE
>
> R> all(Rle(rep(FALSE, 0)))
> [1] TRUE
>
> But ok. Then:
>
> R> any(Rle(rep(FALSE, 0)))
> [1] FALSE
>
> R> any(Rle(rep(TRUE, 0)))
> [1] FALSE
>
> `any` should be more "permissive" than `all`, shouldn't it? But also,
> maybe a 0 length logical Rle should return something else in these
> scenarios?
compare with all(logical()) and any(logical()); here's one thread
https://stat.ethz.ch/pipermail/r-devel/2006-January/036041.html
and a link to wikipedia
http://en.wikipedia.org/wiki/Empty_set
where the 'Operations on an empty set' section is relevant. 'all' is
like product, 'any' like sum, and logical(0) the empty set.
Martin
>
> -steve
>
> sessionInfo()
> R version 2.13.0 Under development (unstable) (2010-09-21 r52957)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=C
> [6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=en_US.UTF-8 LC_NAME=C
> LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> other attached packages:
> [1] IRanges_1.7.39
>
--
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109
Location: M1-B861
Telephone: 206 667-2793
More information about the Bioconductor
mailing list