dist_to_centroids {usedist} | R Documentation |
Compute distances from each item to group centroids
Description
Compute distances from each item to group centroids
Usage
dist_to_centroids(d, g, squared = FALSE)
Arguments
d |
A distance matrix object of class |
g |
A factor representing the groups of items in |
squared |
If |
Details
This function computes the distance from each item to the centroid positions
of groups defined in the argument g
. This is accomplished without
determining the centroid positions directly; see the documentation for
dist_between_centroids
for details on this procedure.
If the distance can't be represented in a Euclidean space, the
CentroidDistance
is set to NaN
. See the documentation for
dist_between_centroids
for further details.
Value
A data frame with distances to the group centroids:
- Item
-
A character vector of item labels from the dist object, or an integer vector of item locations if labels are not present.
- CentroidGroup
-
The group for which the centroid distance is given. The column type should match that of the argument g (the
unique
function is used to generate this column). - CentroidDistance
-
Inferred distance from the item to the centroid position of the indicated group.