R中的Bucketing数据给出错误

时间:2015-11-09 17:21:54

标签: r

我正在尝试将我的数据分成各种类别并在执行相同操作时遇到问题。我无法理解它出错的地方。请帮忙。

new_df<-original_df
new_df$bucket_column<-cut(
                as.numeric(
                  new_df$value_for_bucket_column),
                breaks=c(0,1,2,3,4,5,6,7,14,21,28,60,90,180,365,Inf),
                labels = c("1 Day","1-2 Days","2-3 Days","3- Days",
                "4-5 Days","5-6 Days", "1 Week",
                "1-2 Weeks","2-3 Weeks","3-4 Weeks",
                "1-2 Months","2-3 Months","3-6 Months",
                "6-12 Months","More than a Year"))

当我尝试进行分组时,我面临如下错误:

Error in `$<-.data.frame`(`*tmp*`, "bucket_column", value = integer(0)) : 
  replacement has 0 rows, data has 24783

请让我知道我做错了什么。感谢

0 个答案:

没有答案