0

Im trying to group together data in my data set based on whether the value in one of the columns is 1, 2 or 3. The columns of my data are CLASS and PERF and I want to group based on the CLASS column. The code I have used is

visible2<-visible %>%
group_by(CLASS) %>%
summarise(mean_performance = mean(PERF), sd_performance = sd(PERF))

the output I get is just one value for the mean and standard deviation for the performance across all groups rather than 3 rows, one for each group

  • Probably: [Why does summarize or mutate not work with group_by when I load `plyr` after `dplyr`?](https://stackoverflow.com/questions/26106146/why-does-summarize-or-mutate-not-work-with-group-by-when-i-load-plyr-after-dp) – Henrik May 19 '20 at 20:59

1 Answers1

-1

It could be because the plyr package is also loaded and plyr::summarise masked te dplyr::summarise. We can specify dplyr::summarise explicitly or redo this on a fresh R with only dplyr loaded

library(dplyr)
visible %>%
   group_by(CLASS) %>%
   dplyr::summarise(mean_performance = mean(PERF), sd_performance = sd(PERF))
akrun
  • 874,273
  • 37
  • 540
  • 662