Learn R Programming

labdsv (version 1.8-0)

metrify: Nearest Metric Space Representation of a Dissimilarity Object

Description

Calculates the nearest metric space representation of a dissimilarity object by iterating the transitive closure of the triangle inequality rule

Usage

metrify(x,upper=FALSE,diag=FALSE)

Arguments

x

a distance or dissimilarity object returned from dist, vegdist, or dsvdis

upper

a logical switch to control whether to return the lower triangle (upper=FALSE) or upper triangle (upper=TRUE) of the distance matrix

diag

a logical switch to control whether to return the diagonal of the distance matrix

Value

a object of class ‘dist’

Details

Implements a constrained iteration of the transitive closure of the triangle inequality, such that the distance between any two objects is less than or equal to the sum of the distances from the two objects to a third.

See Also

euclidify

Examples

Run this code
# NOT RUN {
data(bryceveg) # returns a vegetation data.frame
dis.bc <- dsvdis(bryceveg,'bray/curtis') # calculate a Bray/Curtis
            #  dissimilarity matrix
dis.met <- metrify(dis.bc) # calculate the nearest euclidean
            #  representation
# }

Run the code above in your browser using DataLab