Reputation: 57
I remove plyr, load dplyr and check the current packages
detach("package:plyr", unload=TRUE)
library(dplyr)
(.packages())
[1] "dplyr" "bindrcpp" "stats" "graphics" "grDevices" "utils" "datasets"
[8] "methods" "base"
For info here are the conflicts:
conflicts()
[1] "filter" "lag" "body<-" "intersect" "kronecker" "setdiff" "setequal"
[8] "union"
Then I use summarise and get the error. This is the same code that I used 6 months ago without issue.
by_vs_am <- group_by(mtcars, vs, am)
by_vs <- summarise(by_vs_am, n = n())
Error in summarise_impl(.data, dots) : Evaluation error: This function should not be called directly.
Upvotes: 1
Views: 1148
Reputation: 293
As mentioned by others, this has to do with conflicts. Looking at your loaded packages and their dependences can help. For me it was the XML library, so I ran detach("package:XML", unload = TRUE)
to fix it.
Upvotes: 0
Reputation: 1
Try use dplyr::n()
instead.
The code should look like this:
by_vs_am <- group_by(mtcars, vs, am)
by_vs <- summarise(by_vs_am, n = dplyr::n())
Upvotes: 0