customDist: A 'dist' function that supports custom metrics

Description Usage Arguments Value See Also

View source: R/similarity.r

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

1
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


rgp documentation built on May 30, 2017, 12:45 a.m.