R/nearestReftoX.R

Defines functions nearestReftoX

Documented in nearestReftoX

nearestReftoX <- function(x, reference, ...)
#	Find nearest element of reference for each element of x
#	reference should be sorted in increasing order
#	Gordon Smyth
#	3 Jan 2018. Last modified 5 Jan 2018.
{
	nref <- length(reference)
	midpt <- (reference[-nref]+reference[-1L])/2
	findInterval(x,midpt,...)+1L
}

Try the edgeR package in your browser

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

edgeR documentation built on Jan. 16, 2021, 2:03 a.m.