Learn R Programming

RFLPtools (version 2.0)

diffDist: Distance Matrix Computation

Description

This function computes and returns the distance matrix computed by using the specified distance measure to compute the distances between the rows of a data matrix. Instead of the row values as in the case of dist, the successive differences of the row values are used.

Usage

diffDist(x, method = "euclidean", diag = FALSE, upper = FALSE, p = 2)

Arguments

x

a numeric matrix, data frame or "dist" object.

method

the distance measure to be used. This must be one of "euclidean", "maximum", "manhattan", "canberra", "binary" or "minkowski". Any unambiguous substring can be given.

diag

logical value indicating whether the diagonal of the distance matrix should be printed by print.dist.

upper

logical value indicating whether the upper triangle of the distance matrix should be printed by print.dist.

p

The power of the Minkowski distance.

Value

diffDist returns an object of class "dist"; cf. dist.

Details

This function computes and returns the distance matrix computed by using the specified distance measure to compute the distances between the rows of a data matrix. Instead of the row values as in the case of dist, the successive differences of the row values are used.

It's a simple wrapper function arround dist. For more details about the distances we refer to dist.

The function may be helpful, if there is a shift w.r.t.\ the measured bands; e.g.\ c(550, 500, 300, 250) vs.\ c(510, 460, 260, 210).

References

Flessa, F., Kehl, A., Kohl, M. Analysing diversity and community structures using PCR-RFLP: a new software application. Molecular Ecology Resources 2013 Jul; 13(4):726-33.

Examples

Run this code
# NOT RUN {
## assume a shift in the measured bands
M <- rbind(c(550, 500, 300, 250), c(510, 460, 260, 210),
           c(550, 500, 300, 200))
dist(M)
diffDist(M)
# }

Run the code above in your browser using DataLab