R/af.R

Defines functions `af`

`af` <- function(x) {
  if(is.vector(x)) {
   p <- (x[1]+0.5*x[2])/sum(x)
  } else
  if(is.matrix(x)) {
   p <- (x[,1]+0.5*x[,2])/apply(x,1,sum)
  }
  return(p)
}

Try the HardyWeinberg package in your browser

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

HardyWeinberg documentation built on May 7, 2022, 5:05 p.m.