R/ssrx.R

Defines functions ssrx

Documented in ssrx

# Mixed replacement function
ssrx = function(parpop, offpop, reppars, ...){
  n = nrow(parpop)
  m = ncol(parpop)
  if(nrow(offpop) > 1)
    offpop = offpop[order(offpop[,m], decreasing=TRUE),]
  parrn = rownames(parpop)
  offrn = rownames(offpop)
  bidx = which.max(parpop[,m])
  paridx = 1:n
  paridx = paridx[-c(reppars, bidx)]
  pidx = sample(paridx, size=1)
  parpop[pidx,] = offpop[1,]
  parrn[pidx] = offrn[1]
  rownames(parpop) = parrn
  return(parpop)
}

Try the adana package in your browser

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

adana documentation built on March 18, 2022, 6:03 p.m.