Inconistent behavior with all/any and Rle
1
0
Entering edit mode
@steve-lianoglou-2771
Last seen 14 months ago
United States
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? -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 -- Steve Lianoglou Graduate Student: Computational Systems Biology ?| Memorial Sloan-Kettering Cancer Center ?| Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
Cancer Cancer • 547 views
ADD COMMENT
0
Entering edit mode
@martin-morgan-1513
Last seen 21 days ago
United States
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
ADD COMMENT
0
Entering edit mode
On Tue, Oct 12, 2010 at 12:16 AM, Martin Morgan <mtmorgan at="" fhcrc.org=""> wrote: > On 10/11/2010 07:55 PM, Steve Lianoglou wrote: <snip> >> `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. Oh ... ?theory! Luckily my former Discrete Math professor doesn't read this mailing list ... :-) Thanks, -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology ?| Memorial Sloan-Kettering Cancer Center ?| Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact
ADD REPLY

Login before adding your answer.

Traffic: 375 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6