Distance matrix - Sum of all pairwise distances in a distance matrix {Rfast} | R Documentation |
Distance matrix - Sum of all pairwise distances in a distance matrix
Description
Distance matrix - Sum of all pairwise distances in a distance matrix.
Usage
Dist(x, method = "euclidean", square = FALSE, p = 0,vector = FALSE)
total.dist(x, method = "euclidean", square = FALSE, p = 0)
vecdist(x)
Arguments
x |
A matrix with data. The distances will be calculated between pairs of rows. In the case of vecdist this is a vector. For the haversine distance it must be a matrix with two columns, the first column is the latitude and the second the longitude (in radians). |
method |
See details for the available methods. |
square |
If you choose "euclidean" or "hellinger" as the method, then you can have the option to return the squared Euclidean distances by setting this argument to TRUE. |
p |
This is for the the Minkowski, the power of the metric. |
vector |
For return a vector instead a matrix. |
Details
The distance matrix is compute with an extra argument for the Euclidean distances. The "kullback_leibler" refers to the symmetric Kullback-Leibler divergence.
euclidean :
manhattan :
minimum :
maximum :
minkowski :
bhattacharyya :
hellinger :
kullback_leibler :
jensen_shannon :
haversine :
canberra :
chi_square
^2 :
soergel :
sorensen :
cosine :
wave_hedges :
motyka :
harmonic_mean :
jeffries_matusita :
gower :
kulczynski :
Value
A square matrix with the pairwise distances.
Author(s)
Manos Papadakis.
R implementation and documentation: Manos Papadakis <papadakm95@gmail.com>.
References
Mardia K. V., Kent J. T. and Bibby J. M. (1979). Multivariate Analysis. Academic Press.
See Also
Examples
x <- matrix(rnorm(50 * 10), ncol = 10)
a1 <- Dist(x)
a2 <- as.matrix( dist(x) )
x<-a1<-a2<-NULL