From wdunlap at tibco.com  Fri Aug  5 00:20:57 2016
From: wdunlap at tibco.com (William Dunlap)
Date: Thu, 4 Aug 2016 15:20:57 -0700
Subject: [Rd] findInterval(all.inside=TRUE) for degenerate 'vec' arguments
Message-ID: <CAF8bMcbGorHL_zf=M1x7cyMGC5-KnRsHPg+753CpohFx9CU5xA@mail.gmail.com>

What should findInterval(x,vec,all.inside=TRUE) return when length(vec)<=1,
so there are no inside intervals?

R-3.3.0 gives a decreasing map of x->output when length(vec)==1 and -1's
when length(vec)==0.  Would '0' in all those cases be better?

> findInterval(x=c(10, 11, 12), vec=11, all.inside=TRUE,
rightmost.closed=FALSE, left.open=FALSE)
[1] 1 0 0
> findInterval(x=c(10, 11, 12), vec=11, all.inside=TRUE,
rightmost.closed=FALSE, left.open=TRUE)
[1] 1 1 0
> findInterval(x=c(10, 11, 12), vec=11, all.inside=TRUE,
rightmost.closed=TRUE, left.open=FALSE)
[1] 1 0 0
> findInterval(x=c(10, 11, 12), vec=11, all.inside=TRUE,
rightmost.closed=TRUE, left.open=TRUE)
[1] 1 1 0
>
> findInterval(x=c(10, 11, 12), vec=numeric(), all.inside=TRUE,
rightmost.closed=FALSE, left.open=FALSE)
[1] -1 -1 -1
> findInterval(x=c(10, 11, 12), vec=numeric(), all.inside=TRUE,
rightmost.closed=FALSE, left.open=TRUE)
[1] -1 -1 -1
> findInterval(x=c(10, 11, 12), vec=numeric(), all.inside=TRUE,
rightmost.closed=TRUE, left.open=FALSE)
[1] -1 -1 -1
> findInterval(x=c(10, 11, 12), vec=numeric(), all.inside=TRUE,
rightmost.closed=TRUE, left.open=TRUE)
[1] -1 -1 -1

Bill Dunlap
TIBCO Software
wdunlap tibco.com

	[[alternative HTML version deleted]]



[Rd] findInterval(all.inside=TRUE) for degenerate 'vec' arguments
William Dunlap