reshape2 - dcast错误转置〜650k行

时间:2014-12-04 21:51:24

标签: r reshape reshape2

我正在尝试使用reshape2 / dcast通过时间戳转置一些数据。

> head(df1)
              rule         rawdt count                  dt index
1 #31Gifts:31Gifts 2014-11-25T03     1 2014-11-25 03:00:00     1
2 #31Gifts:31Gifts 2014-11-26T16     1 2014-11-26 16:00:00     1
3 #31Gifts:31Gifts 2014-11-16T05     2 2014-11-16 05:00:00     1
4 #31Gifts:31Gifts 2014-11-16T14     1 2014-11-16 14:00:00     1
5 #31Gifts:31Gifts 2014-11-26T00    23 2014-11-26 00:00:00     1
6 #31Gifts:31Gifts 2014-11-19T03     1 2014-11-19 03:00:00     1

当我运行dcast时,我收到此错误:

> wide<-dcast(df1, dt~index, value.var="count")
Error in if (n > 2^31) { : missing value where TRUE/FALSE needed

有人可以提供建议吗?我确实使用以下命令从原始字符串格式创建日期:

df$dt<-strptime(df$rawdt, format="%Y-%m-%dT%H")

POSIXlt日期是否会导致问题?

0 个答案:

没有答案