could not find function “cast” despite reshape2 installed and loaded

ε祈祈猫儿з 提交于 2020-01-14 07:10:08

问题


In following Hadley Wickham's "Practical tools for exploring data and models" examples in section 2.4, Casting molten data I'm getting Error: could not find function "cast". I have the reshape2 package installed and loaded.

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

回答1:


In reshape2, cast() has been replaced by two functions: acast() and dcast().

From ?cast, in package reshape2:

Description:

Use ‘acast’ or ‘dcast’ depending on whether you want vector/matrix/array output or data frame output.




回答2:


Had related issue (Error: could not find function "dcast"). I had old library, library(plyr), so just added to code...

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

Then dcast worked again



来源:https://stackoverflow.com/questions/12468843/could-not-find-function-cast-despite-reshape2-installed-and-loaded

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!