.BG
.VE $Header: /usr/s/current/s/.help/RCS/dist,v 1.3 86/09/17 13:16:35 rab Exp $
.FN dist
.TL
dist: Distance Matrix Calculation
.CS
dist(x, metric)
.PP
.AG x
matrix (typically a data matrix).  The distances computed
will be among the rows of `x'.  Missing values (NAs) are
allowed.
.AG metric
character string specifying the distance metric to be used.
The currently available options are "euclidean" (the
default), "maximum", "manhattan", and "binary".
Euclidean distances are root sum-of-squares of differences,
maximum is the maximum difference, manhattan is the sum
of absolute differences, and binary is the proportion
of non-zeroes that two vectors have in common.
.RT
the distances among
the rows of `x'.  Since this structure can be very large,
and since the result of `dist' is typically an argument to
`hclust', a special structure is returned, rather than a matrix.
.RC Size
the number of objects (that is, rows of `x').
.RC Data
the `Size*(Size\-1)/2' values.
.PP
Missing values in a row of `x' are not included in any distances
involving that row.  Such distances are then inflated to account for
the missing values.  If all values for a particular distance are
excluded by this rule, the distance is NA.
.EX
dist(x,"max") # distances among rows by maximum
dist(t(x)) # distances among cols by euclidean
.KW array*
.KW multivariate
.KW cluster
.WR
