R/AllSeqDists.R

Defines functions AllSeqDists

Documented in AllSeqDists

#' Calculate all distances between a set of sequences and a fixed sequence.
#' 
#' Used to calculate the sequence Kendall distance distribution in N! space.
#' 
#' 
#' @param seqs Matrix or data frame of sequences.
#' @return Vector of the distances from the sequences to 1:N.
#' @author Erik Gregory
#' @keywords Kendall Distance


AllSeqDists <-
function(seqs) {
  modal <- 1:ncol(seqs)
  infos <- KendallInfo(seqs)
  dists <- apply(infos, 1, function(i) length(which(i == 1)))
  return(dists)
}

Try the RMallow package in your browser

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

RMallow documentation built on Feb. 7, 2020, 9:06 a.m.