我正在运行dplyr :: summarize的示例代码,但没有得到我期望的结果。
summarise(group_by(mtcars, cyl),
mean = mean(disp))
mean
1 230.7219
ddply(mtcars, .(cyl), summarise,
mean = mean(disp))
cyl mean
1 4 105.1364
2 6 183.3143
3 8 353.1000
这里发生了什么?
sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
dplyr_0.1.2
plyr_1.8