R/calibrar-fitness_aux.R

Defines functions .weighted.sum .globalFitness

.weighted.sum = function(x, w, ..., na.rm=FALSE) {
  if(isTRUE(na.rm)) {
    ind = !is.na(x)
    x = x[ind]
    w = w[ind]
  }
  return(sum(x*w))
}

.globalFitness = function(fitness, opt) {
  # must receive fitness and optionally weight argument
  aggFn = match.fun(opt$aggFn)
  out   = apply(fitness, 1, aggFn, w=opt$weights)
  return(out)

}

Try the calibrar package in your browser

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

calibrar documentation built on May 2, 2019, 10:58 a.m.