R/wildCollapse.R

Defines functions wildCollapse

wildCollapse <- function(x) {
  maxAlleles <- nrow(x) - 1
  wildCol <- rep(NA, maxAlleles + 1)
  for (s in 0:maxAlleles) wildCol[s + 1] <- sum(diag(as.matrix(x[0:s + 1, rev(0:s + 1)])))
  names(wildCol) <- 0:maxAlleles
  wildCol
}

Try the DNAtools package in your browser

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

DNAtools documentation built on July 8, 2020, 7:13 p.m.