Learn R Programming

labdsv (version 2.0-1)

euclidify: Nearest Euclidean Space Representation of a Dissimilarity Object

Description

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

Usage

euclidify(dis,upper=FALSE,diag=FALSE)
as.euclidean(dis,upper=FALSE,diag=FALSE)

Value

An object of class ‘dist’

Arguments

dis

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

Details

Implements a constrained iteration of the transitive closure of Pythagoras' theorem, such that the squared distance between any two objects is less than or equal to the sum of the squared distances from the two objects to all possible third objects.

See Also

metrify

Examples

Run this code
data(bryceveg) # returns a vegetation data.frame
dis.bc <- dsvdis(bryceveg,'bray/curtis') # calculate a Bray/Curtis
                                         # dissimilarity matrix
dis.euc <- euclidify(dis.bc) # calculate the nearest euclidean 
                             # representation 
if (FALSE) plot(dis.bc,dis.euc)

Run the code above in your browser using DataLab