R/sampleIndiv.R

"sampleIndiv" <- function(Pedig, from="Born", each=100){
  IDs  <- split(Pedig$Indiv, Pedig[[from]])
  keep <- unlist(mapply(sample, x=IDs, size=pmin(lapply(IDs,length), each), SIMPLIFY=FALSE))
  names(keep)<-NULL
  keep
}

Try the optiSel package in your browser

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

optiSel documentation built on May 31, 2023, 6:50 p.m.