R newbie在这里,在R中重建Python管道。
d
是data.frame():
$ day (chr) "2016-10-13", ...
$ city_name (chr) "SF", ...
$ type (chr) "Green", ...
$ count (int) 10, ...
我对来自tidyr package
的数据进行了spread()
:
d %>% spread(type,count)
使用本地(Mac)正常运行:
R version 3.3.0 (2016-05-03)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.5 (El Capitan)
tidyr_0.6.1
我在同一输入d
上的Linux机器上运行相同的命令,但它返回错误:
Error in `[.data.table`(.variables, lengths != 0) : i evaluates to a logical vector length 3 but there are 930 rows. Recycling of logical i is no longer allowed as it hides more bugs than is worth the rare convenience. Explicitly use rep(...,length=.N) if you really need to recycle.
在Linux上,我正在运行:
R version 3.2.5 (2016-04-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu precise (12.04.5 LTS)
tidyr_0.6.0
知道这个错误意味着什么,以及为什么会抛出它?
编辑:在Linux上更新tidyr
,和重新启动R会话后修复此问题。