How do I count the number of times where A happened and B happened with R from a table? -
let's data
a b c 0 1 0 1 1 0 <- here , b 1 1 0 0 0 1 1 1 1 1 <- here 1 1 0 <- , here
i want count number of times both , b 1. in case 3. easy sql have no idea how r.
if df
data.frame columns, a,b,c
:
sum(df$a==1 & df$b==1)
Comments
Post a Comment