Hi All!
I have a data frame consisting of categorical variables on which I wish to
perform kmode clustering with 20 clusters.
I am trying to use Kmodes from R package klaR.
The code works fine when I set use simple distance for clustering by
setting weighted=FALSE in the function kmodes. However it throws an error
when I try setting weighted=TRUE.
Data frame :
Df
Zone Price Oc Peek Name Type Efficiency
1 W H Owned 0 TRIPLE Mech low
2 W H Owned 0 DOUBLE Mech low
3 W H Owned 0 TRIPLE Vidl high
4 E L Owned 0 DOUBLE Mechl low
5 S L Owned 0 BLACK Vid low
6 W H Owned 1 QUICK 7 Mech high
The actual rows in Df is 5000
code : Kmodres<-kmodes(Df, 20, weighted = TRUE )
Error :Error in n_obj[i] <- weight[which(names == obj[different[i]])] :
replacement has length zero
Am i doing something wrong?
Thank you in advance for any help.
-SB
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.