Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/kubernetes/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R中的cut.default错误_R - Fatal编程技术网

R中的cut.default错误

R中的cut.default错误,r,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,lab

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

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 

babbie$CHLDIDEL尝试提供一个可复制的示例(例如,提供一些数据)。似乎您正在将一个非数值的变量传递给
cut
。也许你已经有了你第一次试穿
cut
character
结果存储在
babbie$CHLDIDEL
中,请检查
class(babbie$CHLDIDEL)
“'x'必须是数字”大致是“x'doitêtre numérique”的翻译。只需在这里发布您的数据和分析计划,我们将为您解决这些问题。