[R] custom metric for dist for use with hclust/kmeans

Vivek Ayer vivek.ayer at gmail.com
Wed May 5 19:13:24 CEST 2010


Hi guys,

I've been using the kmeans and hclust functions for some time now and
was wondering if I could specify a custom metric when passing my data
frame into hclust as a distance matrix. Actually, kmeans doesn't even
take a distance matrix; it takes the data frame directly. I was
wondering if there's a way or if there's a package that lets you
create distance matrices from non-standard metrics, e.g.,
KL-divergence (which is not really one), but metrics used often in
information theory. I'm assuming kmeans just assumes the euclidean
metric, but it would be nice to customize that as well. Is stuff out
there, or would I have create my own?

Thanks,
Vivek



More information about the R-help mailing list