Learn R Programming

LearnClust (version 1.1)

distances: To calculate distances applying weights.

Description

To calculate distances between two clusters applying weights depending on the distance type.

Usage

distances(cluster1, cluster2, distance, weight)

Arguments

cluster1

is a matrix.

cluster2

is a matrix.

distance

is a string. The distance type to apply.

weight

is a numeric vector.

Value

Distance value applying weights.

Details

This function calculates distance applying distance type and applying each weight to its characteristic.

Distance type could be EUC, MAN, CAN, CHE or OCT.

Examples

Run this code
# NOT RUN {
cluster1 <- matrix(c(2,3))
cluster2 <- matrix(c(4,5))

weight1 <- c(0.6,0.4)
weight2 <- c(2,4)

distances(cluster1, cluster2, 'MAN', weight1)

distances(cluster1, cluster2, 'CHE', weight2)

# }

Run the code above in your browser using DataLab