Tyu1990 Tyu1990 - 4 months ago 35
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))