R/whichIn.R

Defines functions whichIn

Documented in whichIn

whichIn <- function(pos,bounds) {
	a <- c(-Inf,bounds,Inf,pos)
	b <- c(1:(length(bounds)+2),rep(0,length(pos)))
	h1 <- order(a)
	hr <- b[h1]
	intpos <- cummax(hr)[which(hr==0)]-1
	intpos[intpos==0] <- -Inf
	intpos[intpos==length(bounds)] <- Inf
	intpos
}

Try the Starr package in your browser

Any scripts or data that you put into this service are public.

Starr documentation built on April 28, 2020, 7:52 p.m.