R中cut.default出错

时间:2014-04-29 18:23:12

标签: r

我有错误,但我不知道如何解决。这是我的代码:

babbie$CHLDIDEL <- cut(babbie$CHLDIDEL, c(0, 1, 2, 3, 8))
table(babbie$CHLDIDEL)
##(0,1] (1,2] (2,3] (3,8] 
##   17   502   217   153 

babbie$CHLDIDEL <- cut(babbie$CHLDIDEL,c(0, 1, 2, 3, 8), include.lowest = TRUE,labels = c("0", "1", "2", "3", ">4"))
##Error in cut.default(babbie$CHLDIDEL, c(0, 1, 2, 3, 8), include.lowest = TRUE,  : 
##  'x' doit être numérique

table(babbie$CHLDIDEL)
##(0,1] (1,2] (2,3] (3,8] 
##   17   502   217   153 

0 个答案:

没有答案