0

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?

Scarabee
  • 5,437
  • 5
  • 29
  • 55
Tyu1990
  • 147
  • 1
  • 1
  • 6
  • 2
    It's not easy to understand what you want to do, could you provide an example? You should read this:[How to make a great R reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610) – Scarabee Oct 30 '16 at 19:28
  • do you possibly want `DB.all %>% group_by(Family) %>% summarise_all(sum)` ... ? – Ben Bolker Oct 30 '16 at 22:50
  • If python helps, knock. –  Oct 30 '16 at 22:51
  • 1
    If you want to take a sum, then you need to use the `sum` function somewhere... – Gregor Thomas Oct 30 '16 at 22:53

1 Answers1

1

Try this:

library(dplyr)
b <- DB.all %>% group_by(Family) %>% summarise(sum(x))
Scarabee
  • 5,437
  • 5
  • 29
  • 55