0

I am trying to compute the mean amount spent on wine by education level. When I go to filter the data I do this:

marketing %>%
select(Education, MntWines) %>%
group_by(Education) %>%
summarise(MntWines_mean= mean(MntWines))

And I get this outputa 1x1 table with just MntWines mean

How do I get the means for each output?

  • 1
    Can you share some sample data, so that we can check what is happening? – Eva Sep 27 '22 at 00:17
  • My guess is that you are inadvertently using `plyr::summarise` instead of `dplyr::summarise`. To verify, type `summarise` and confirm whether it ends with `namespace:plyr` or `namespace:dplyr`. Related: https://stackoverflow.com/q/31644739/3358272 and https://krlmlr.github.io/pdlyr/vignettes/pdlyr.html. – r2evans Sep 27 '22 at 00:23
  • The _fix_: in the short term, use `%>% dplyr::summarise(...)`; in the long term, load plyr first (or not at all). – r2evans Sep 27 '22 at 00:24

0 Answers0