dist_wrt_centers {svs}R Documentation

Compute Distances with respect to Cluster Centers

Description

A function for computing (euclidean) distances with respect to specified cluster centers.

Usage

dist_wrt_centers(x, clusters, freq = NULL, members_only = TRUE)

Arguments

x

A numeric matrix (containing coordinates).

clusters

A clustering of the row levels of x: either a list or the output of kmeans.

freq

An optional vector of frequency counts for the row levels of x.

members_only

Logical specifying whether the distances from the cluster centers should only be computed for the cluster members.

Value

A list with a matrix of distances for every cluster.

See Also

centers_ca, freq_ca.

Examples

SndT_Fra <- read.table(system.file("extdata", "SndT_Fra.txt", package = "svs"),
   header = TRUE, sep = "\t", quote = "\"", encoding = "UTF-8",
   stringsAsFactors = FALSE)
sca.SndT_Fra <- fast_sca(SndT_Fra)
kcl.SndT_Fra <- kmeans(sca.SndT_Fra$pos1, centers = 7)
dist_wrt_centers(sca.SndT_Fra$pos1, clusters = kcl.SndT_Fra, freq = freq_ca(SndT_Fra[, 1]))

[Package svs version 3.0.0 Index]