distance: distance

Description Usage Arguments Value Examples

Description

Calculates the Manhanttan distance between the medians and every point in the dataset

Usage

1
distance(X, medians)

Arguments

X

a matrix, the dataset being clustered

medians

a matrix, dedians of the clusters

Value

a matrix, distance between each point and each median

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
A <- matrix(
c(1,2,3,4,5,6),
nrow = 3,
ncol = 2,
byrow = TRUE)
m <- matrix(
  c(1,1,2,2),
  nrow = 2,
  ncol = 2,
 byrow = TRUE)
distance(A,m)

UBC-MDS/KMediansR documentation built on May 7, 2019, 7:14 p.m.