R/classDist.R

#' Calculate the share of identical classifications between two individuals, choose if euclidean of match
#'
#' @param x is an object
#' @return y is the output
#' @export

classDist <- function(x,y, length_x = NA, euclidean = TRUE){

  if(euclidean){
    dist <- sqrt(sum((x-y)^2))
  } else {
    dist <- sum(x==y)/length_x
  }

  return(dist)
}
thomaswiemann/SMLpractical documentation built on May 28, 2019, 12:23 p.m.