% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dist.R
\name{dist}
\alias{dist}
\alias{get_dist}
\alias{fviz_dist}
\title{Enhanced Distance Matrix Computation and Visualization}
\usage{
get_dist(x, method = "euclidean", stand = FALSE, ...)

fviz_dist(
  dist.obj,
  order = TRUE,
  show_labels = TRUE,
  lab_size = NULL,
  gradient = list(low = "red", mid = "white", high = "blue")
)
}
\arguments{
\item{x}{a numeric matrix or a data frame.}

\item{method}{the distance measure to be used. This must be one of 
"euclidean", "maximum", "manhattan", "canberra", "binary", "minkowski", 
"pearson", "spearman" or "kendall".}

\item{stand}{logical value; default is FALSE. If TRUE, then the data will be
standardized using the function \code{scale()}. Measurements are
standardized for each variable (column), by subtracting the variable's
mean value and dividing by the variable's standard deviation. If scaling
produces \code{NA} values, \code{get_dist()} stops with a package-level
error.}

\item{...}{other arguments to be passed to the function dist() when using get_dist().}

\item{dist.obj}{an object of class "dist" as generated by the function
\code{dist()} or \code{get_dist()}, containing only finite dissimilarity
values.}

\item{order}{logical value. if TRUE the ordered dissimilarity image (ODI) is shown.}

\item{show_labels}{logical value. If TRUE, the labels are displayed.}

\item{lab_size}{the size of labels.}

\item{gradient}{a list containing three elements specifying the colors for low, mid and high values in 
the ordered dissimilarity image. The element "mid" can take the value of NULL.}
}
\value{
\itemize{ \item get_dist(): returns an object of class "dist". \item 
  fviz_dist(): returns a ggplot2 }
}
\description{
Clustering methods classify data samples into groups of similar 
  objects. This process requires some methods for measuring the distance or 
  the (dis)similarity between the observations. Read more: 
  \href{https://www.datanovia.com/en/lessons/clustering-distance-measures/}{STHDA
   website - clarifying distance measures.}. \itemize{ \item get_dist():
  Computes a distance matrix between the rows of a data matrix. Compared to
  the standard \code{\link[stats]{dist}}() function, it supports
  correlation-based distance measures including "pearson", "kendall" and
  "spearman" methods. \item fviz_dist(): Visualizes a distance matrix }

  When \code{stand = TRUE}, scaling that produces non-finite values is
  rejected. \code{fviz_dist()} also validates that supplied distance objects
  contain only finite values before plotting.
}
\examples{
data(USArrests)
res.dist <- get_dist(USArrests, stand = TRUE, method = "pearson")

fviz_dist(res.dist, 
   gradient = list(low = "#00AFBB", mid = "white", high = "#FC4E07"))
}
\seealso{
\code{\link[stats]{dist}}
}
\author{
Alboukadel Kassambara \email{alboukadel.kassambara@gmail.com}
}
