Hi,
New to R. Can anybody explain how to use .group("drop")? Why do we need .group = "drop". Please see the example below. Thanks
filtered_toothgrowth <- ToothGrowth %>%
filter(dose == 0.5) %>%
group_by(supp) %>%
summarize(mean_len = mean(len, na.rm = T), .group = "drop")
It should be .groups = "drop"
(plural)
In your particular example it doesn't matter, but when there are more than one grouping variables it does.
The default behaviour is to drop the last variable as that was the behaviour before the .groups
argument was introduced. Dropping all variables would make more sense, but the default is there for backward compatibility.
Thank you Martin.
so the .groups = "drop" is related to group_by(supp)?
What does it mean "dropping all variables"?
Regards
Thank you! have a nice day!