Learn R Programming

DiscreteGapStatistic (version 1.1.2)

distancematrix: Calculate categorical distance matrix for discrete data

Description

Function invoking discrete distance functions. Available distances: 'bhattacharyya', 'chisquare', 'cramerV', 'hamming' and 'hellinger'

Usage

distancematrix(X, d)

Value

R distance object

Arguments

X

Matrix where rows are the observations and columns are discrete features

d

Name of distance. Distances available: bhattacharyya, chisquare, cramerV, hamming and hellinger

Examples

Run this code
X = rbind(matrix(paste0("a", rpois(7*5, 1)), nrow=5),
          matrix(paste0("a", rpois(7*5, 3)), nrow=5))
distancematrix(X = X, d = "hellinger")

Run the code above in your browser using DataLab