dplyr group_by and .groups

.groups is an argument in summarise()
See

?summarise

I think we need more information about what you are doing before anyone can comment on a rewrite of the command.