1
votes

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.

2
use it in this fasion: dplyr::summarise(by_vs_am, n = n())Andre Elrico
learn more? -> google: "masking function r"Andre Elrico
Your code works in a clean R session.Rui Barradas
@AndreElrico dplyr::summarise gives me the same error the OP is getting.Rui Barradas
I did test it now. For me it works.Andre Elrico

2 Answers

0
votes

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())
0
votes

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.