18

遵循 Hadley Wickham在第 2.4 节中的“探索数据和模型的实用工具”示例,我得到了铸造熔融数据Error: could not find function "cast"。我已经安装并加载了 reshape2 包。

> cast(msmithsm, time + subject ~ variable)
Error: could not find function "cast"
4

2 回答 2

23

reshape2中,cast()已被两个函数替换:acast()dcast().

?cast,在reshape2包中:

描述:

根据您想要矢量/矩阵/数组输出还是数据帧输出,使用“acast”或“dcast”。

于 2012-09-18T00:31:06.647 回答
2

有相关问题(错误:找不到函数“dcast”)。我有旧图书馆,图书馆(plyr),所以只是添加到代码中......

install.packages("reshape2") # may already be installed
library(reshape2)

然后 dcast 再次工作

于 2018-06-10T14:43:17.143 回答