Description Usage Arguments Details Value Examples

`gdist`

computes and returns the distance matrix computed by using user-defined distance measure.

1 2 3 |

`x` |
a numeric matrix, data frame or ‘dist’ object. |

`method` |
the distance measure to be used. This can either be one of
the methods used in |

`MoreArgs` |
a list of other arguments to be passed to |

`diag` |
logical value indicating whether the diagonal of the distance matrix should be
printed by |

`upper` |
logical value indicating whether the upper triangle of the distance matrix should be
printed by |

`d` |
an R object. |

`is.dist`

tests if its argument is a ‘dist’ object.

The distance (or dissimilarity) function (`FUN`

) can be any distance measure applied to `x`

.
For instance, `"euclidean"`

, `"maximum"`

, `"manhattan"`

,`"canberra"`

,
`"binary"`

, `"minkowski"`

, "correlation.of.variables", "correlation.of.observations" or
`gmdm`

. "correlation.of.variables" computes the correlation distance of
the variables (the columns); all the other compute the distances between
the observations (the rows) of a data matrix.

`gdist`

returns an object of ‘dist’.

`is.dist`

returns a logical value whether an object is ‘dist’.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ```
## load library
require("GMD")
require(cluster)
## compute distance using Euclidean metric (default)
data(ruspini)
x <- gdist(ruspini)
## see a dendrogram result by hierarchical clustering
dev.new(width=12, height=6)
plot(hclust(x),
main="Cluster Dendrogram of Ruspini data",
xlab="Observations")
## convert to a distance matrix
m <- as.matrix(x)
## convert from a distance matrix
d <- as.dist(m)
stopifnot(d == x)
## Use correlations between variables "as distance"
data(USJudgeRatings)
dd <- gdist(x=USJudgeRatings,method="correlation.of.variables")
dev.new(width=12, height=6)
plot(hclust(dd),
main="Cluster Dendrogram of USJudgeRatings data",
xlab="Variables")
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.