How can I use the group_by() function within summarize() as below:
summarize(group_by(product),sum(Sales))
How can I use the group_by() function within summarize() as below:
summarize(group_by(product),sum(Sales))
Using pipes is the easiest way, but if you need to find the issue with the current nested form, you need to pass the dataframe of interest (let's say it is df) to group_by.
Instead of:
summarize(group_by(product),sum(Sales))
use:
summarize(group_by(df,product),sum(Sales))
The first is something like:
summarize(group_by(Species), mean(Petal.Length))
where iris is missing.