Learn R Programming

DBCVindex (version 1.1)

compute_pair_to_pair_dists: Function to compute pairwise distances and ensure matrix format

Description

Function to compute pairwise distances and ensure matrix format

Usage

compute_pair_to_pair_dists(data, metric = "euclidean")

Value

a pairwise distances' matrix

Arguments

data

input clustering results

metric

metric of the distance, Euclidean by default

Examples

Run this code

n = 300; noise = 0.05; seed = 1782;
theta <- seq(0, pi, length.out = n / 2)
 x1 <- cos(theta) + rnorm(n / 2, sd = noise)
 y1 <- sin(theta) + rnorm(n / 2, sd = noise)
 x2 <- cos(theta + pi) + rnorm(n / 2, sd = noise)
 y2 <- sin(theta + pi) + rnorm(n / 2, sd = noise)
 X <- rbind(cbind(x1, y1), cbind(x2, y2))

dist_matrix <- compute_pair_to_pair_dists(X)

Run the code above in your browser using DataLab