错误包KlaR kmodes:错误:如果正数,列索引必须最大为5,​​而不是6 [英] Error Package KlaR kmodes : Error: Column index must be at most 5 if positive, not 6

查看:77
本文介绍了错误包KlaR kmodes:错误:如果正数,列索引必须最大为5,​​而不是6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将klaR kmodes算法应用于以下数据集

Applying the klaR kmodes algorith to the below dataset

> summary(raw)
    CREDIT_LIMIT         CP        gender     IE_CHILD_NB IE_TOT_DEP_NB    TOTAL_INCOME   IE_HOUSE_CHARGE  maritial    
 >2000    :  612   11500  :  145   MM: 5435   0:7432      0:1446        >2000    :3524   >2000    :    2   D   : 1195  
 0-500    :10458   11100  :   90   MR:12983   1:4119      1:3748        0-500    :1503   0-500    :17146   M   :10507  
 1000-1500: 2912   08830  :   71              2:5787      2:3386        1000-1500:6649   1000-1500:   44   MISS: 1446  
 1500-2000: 2254   11406  :   68              3: 947      3:3740        1500-2000:4116   1500-2000:    5   Ot  : 1043  
 500-1000 : 2182   35018  :   66              4: 133      4:6098        500-1000 :2626   500-1000 : 1221   S   : 4227  
                   11510  :   62                                                                                       
                   (Other):17916                                                                                       
  new_age      job_age     
 >70  : 295   0-20 :14627  
 0-30 : 815   20-30: 1986  
 30-40:4867   30-40:  612  
 40-50:7293   40-50:  124  
 50-60:3883   50-60: 1069  
 60-70:1265              

我收到以下错误

> cluster.results <-kmodes(data=raw, modes=4, iter.max = 10, weighted=FALSE )
Error: Column index must be at most 5 if positive, not 6

有关错误的任何想法吗?

Any idea about what is the error about?

最佳

推荐答案

就我而言,我已经使用dplyr进行了数据转换.所以我要做的就是将对象转换为数据框:

In my case, i have used dplyr for doing data transformation. so what I did was converting my object to data frame:

tmp = as.data.frame(tmp)

我的问题解决了.

这篇关于错误包KlaR kmodes:错误:如果正数,列索引必须最大为5,​​而不是6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆