rgp (version 0.4-1)

customDist: A dist function that supports custom metrics

Description

This function computes and returns the distance matrix computed by using the given metric to compute the distances between the rows of a data list or vector. Note that in contrast to dist, x has to be a vector and the the distance metric is an arbitrary function that must be symmetric and definite.

Usage

customDist(x, metric, diag = FALSE, upper = FALSE)

Arguments

x
A vector or list of objects.
metric
A metric, i.e. a function of two arguments that returns a numeric. Note that a metric must be definite and symmetric, otherwise the results will be undefined.
diag
TRUE iff the diagonal of the distance matrix should be printed by print.dist.
upper
TRUE iff the upper triangle of the distance matrix should be printed by print.dist.

Value

A distance matrix.

See Also

dist