Tyu1990 Tyu1990 - 8 months ago 48
R Question

How to create a sum if multiple criteria

I have to create a "sum if" by column with multiple criteria.

I've tried this:

b <- DB.all %>% group_by(Family) %>% summarise(x)

But it doesn't work.

How can I do it?


Try this:

b <- DB.all %>% group_by(Family) %>% summarise(sum(x))