| Line 1... |
Line 1... |
| 1 |
% File src/library/stats/man/dist.Rd
|
1 |
% File src/library/stats/man/dist.Rd
|
| 2 |
% Part of the R package, https://www.R-project.org
|
2 |
% Part of the R package, https://www.R-project.org
|
| 3 |
% Copyright 1995-2014 R Core Team
|
3 |
% Copyright 1995-2017 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{dist}
|
6 |
\name{dist}
|
| 7 |
\alias{dist}
|
7 |
\alias{dist}
|
| 8 |
\alias{print.dist}
|
8 |
\alias{print.dist}
|
| Line 30... |
Line 30... |
| 30 |
|
30 |
|
| 31 |
\method{as.matrix}{dist}(x, \dots)
|
31 |
\method{as.matrix}{dist}(x, \dots)
|
| 32 |
}
|
32 |
}
|
| 33 |
\arguments{
|
33 |
\arguments{
|
| 34 |
\item{x}{a numeric matrix, data frame or \code{"dist"} object.}
|
34 |
\item{x}{a numeric matrix, data frame or \code{"dist"} object.}
|
| 35 |
\item{method}{the distance measure to be used. This must be one of
|
35 |
\item{method}{the distance measure to be used. This must be one of
|
| 36 |
\code{"euclidean"}, \code{"maximum"}, \code{"manhattan"},
|
36 |
\code{"euclidean"}, \code{"maximum"}, \code{"manhattan"},
|
| 37 |
\code{"canberra"}, \code{"binary"} or \code{"minkowski"}.
|
37 |
\code{"canberra"}, \code{"binary"} or \code{"minkowski"}.
|
| 38 |
Any unambiguous substring can be given.}
|
38 |
Any unambiguous substring can be given.}
|
| 39 |
\item{diag}{logical value indicating whether the diagonal of the
|
39 |
\item{diag}{logical value indicating whether the diagonal of the
|
| 40 |
distance matrix should be printed by \code{print.dist}.}
|
40 |
distance matrix should be printed by \code{print.dist}.}
|
| Line 61... |
Line 61... |
| 61 |
and \eqn{y} (supremum norm)}
|
61 |
and \eqn{y} (supremum norm)}
|
| 62 |
|
62 |
|
| 63 |
\item{\code{manhattan}:}{Absolute distance between the two vectors (1 norm aka \eqn{L_1}).}
|
63 |
\item{\code{manhattan}:}{Absolute distance between the two vectors (1 norm aka \eqn{L_1}).}
|
| 64 |
|
64 |
|
| 65 |
\item{\code{canberra}:}{
|
65 |
\item{\code{canberra}:}{
|
| - |
|
66 |
%% till 2017-07-15: \eqn{\sum_i |x_i - y_i| / |x_i + y_i|}{sum(|x_i - y_i| / |x_i + y_i|)}.
|
| 66 |
\eqn{\sum_i |x_i - y_i| / |x_i + y_i|}{sum(|x_i - y_i| / |x_i + y_i|)}.
|
67 |
\eqn{\sum_i |x_i - y_i| / (|x_i| + |y_i|)}{sum(|x_i - y_i| / (|x_i| + |y_i|))}.
|
| 67 |
Terms with zero numerator and denominator are omitted from the sum
|
68 |
Terms with zero numerator and denominator are omitted from the sum
|
| 68 |
and treated as if the values were missing.
|
69 |
and treated as if the values were missing.
|
| 69 |
|
70 |
|
| 70 |
This is intended for non-negative values (e.g., counts): taking the
|
71 |
This is intended for non-negative values (e.g., counts), in which
|
| 71 |
absolute value of the denominator is a 1998 \R modification to
|
72 |
case the denominator can be written in various equivalent ways;
|
| - |
|
73 |
Originally, \R used \eqn{x_i + y_i}, then from 1998 to 2017,
|
| 72 |
avoid negative distances.
|
74 |
\eqn{|x_i + y_i|}, and then the correct \eqn{|x_i| + |y_i|}.
|
| 73 |
}
|
75 |
}
|
| 74 |
|
76 |
|
| 75 |
\item{\code{binary}:}{(aka \emph{asymmetric binary}): The vectors
|
77 |
\item{\code{binary}:}{(aka \emph{asymmetric binary}): The vectors
|
| 76 |
are regarded as binary bits, so non-zero elements are \sQuote{on}
|
78 |
are regarded as binary bits, so non-zero elements are \sQuote{on}
|
| 77 |
and zero elements are \sQuote{off}. The distance is the
|
79 |
and zero elements are \sQuote{off}. The distance is the
|