R/bestmatch.R

Defines functions bestmatch

bestmatch <-
function(rsize,size){
        z<-cbind(c(rsize,size),c(rep(1,length(rsize)),rep(0,length(size))))
        z<-z[order(z[,1]),]
        mymatch<-rep(NA,length(size))
        osize<-order(size)
        orsize<-order(rsize)
        mymatch[osize]<-orsize[cumsum(z[,2])[z[,2]==0]]
        return(mymatch)
}

Try the TBEST package in your browser

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

TBEST documentation built on May 25, 2022, 9:11 a.m.