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

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.