R/SampleMat2.R

`.SampleMat2` <-
function(ref, ratio)
{
    ntot <- length(ref)
    npres<- sum(ref)    
    ncal <- ceiling(ntot*ratio)

    pres <- sample(which(ref==1), ceiling(npres*ratio))
    absc <- sample(which(ref==0), ncal-length(pres))
    
    samprows <- list("calibration"=c(pres,absc), "evaluation"=(1:ntot)[-c(pres,absc)])
    return(samprows)
}

Try the BIOMOD package in your browser

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

BIOMOD documentation built on May 2, 2019, 6:48 p.m.