Summarise - possible code improvement

When I run this line of code:


DATAFRAMEINPUT = DATAFRAMEINPUT_NS %>% group_by(NC8,ANO_REF,MES_REF) %>% summarise(PU_ML = mean(PU_ML))

I get the following message:

summarise() has grouped output by 'NC8', 'ANO_REF'. You can override using the .groups argument.

How can I improve the code?

That is just a help message.

You can use the .groups argument from here:
Summarise each group to fewer rows — summarise • dplyr (tidyverse.org)

Alternatively, add this to the end of your code to ungroup:

%>% ungroup()
1 Like