R/dist.R

Defines functions dist

Documented in dist

#' Distance Matrix Computation
#'
#' Adds the ability to compute the Khi2 distance between the rows of a matrix to
#' the stats::dist function. Computation is done in C++ via Rcpp.
#'
#' @param L matrix, data.frame
#' @param method character
#'
#' @return matrix, data.frame, dist
#'
#' @export
dist <- function(L, method = "khi2") {
  if (method == "khi2") {
    D <- dist_khi2_cpp(L)
  } else {
    D <- stats::dist(L, method)
  }
  D
}
vadmbertr/bonski.predict documentation built on Dec. 23, 2021, 2:06 p.m.