dplyr:“n()中的错误:函数不应该直接调用” [英] dplyr: "Error in n(): function should not be called directly"
本文介绍了dplyr:“n()中的错误:函数不应该直接调用”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
库(dplyr)
#总结剥离单层分组
by_vs_am< - group_by(mtcars,vs,am)
by_vs< - summarize(by_vs_am,n = n())
# ):这个函数不应该被直接调用
解决方案
您在同一会话中加载了 dplyr
和 plyr
。 dplyr
不是 plyr
。 ddply
不是 dplyr
包中的函数。
dplyr
和 plyr
的功能总结
/ 总结
。
查看 conflicts()
以查看蒙版对象。
I am attempting to reproduce one of the examples in the dplyr package but this error message. I am expecting to see a new column n produced with the frequency of each combination. Can someone tell me what I am missing? I triple checked that the package is loaded. Thanks for the help, as always.
library(dplyr)
# summarise peels off a single layer of grouping
by_vs_am <- group_by(mtcars, vs, am)
by_vs <- summarise(by_vs_am, n = n())
#Error in n() : This function should not be called directly
解决方案
I presume you have dplyr
and plyr
loaded in the same session. dplyr
is not plyr
. ddply
is not a function in the dplyr
package.
Both dplyr
and plyr
have the functions summarise
/summarize
.
Look at the results of conflicts()
to see masked objects.
这篇关于dplyr:“n()中的错误:函数不应该直接调用”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文