dist.chi2.Rd
Computes the chi-squared distance between the rows of a data frame of factors.
dist.chi2(X)
data frame. All variables should be factors.
This function is adapted from chi2Dist
function in ExPosition
package.
A symmetrical matrix of distances
data(Music)
d <- dist.chi2(Music[,1:5])
# a short piece of the distance matrix
d[1:3, 1:3]
#> [,1] [,2] [,3]
#> [1,] 0.00000 33.32566 20.51546
#> [2,] 33.32566 0.00000 12.81019
#> [3,] 20.51546 12.81019 0.00000