aaa<- data.frame(sex=c(1,1,2,2,1,1), group1=c(1,2,1,2,2,2),group2=c("A","B","A","B","A","B"))
stata command:
count if sex==1 & group1==2
count if sex==1 & group2=="A"
count counts the number of observations that satisfy the specified conditions. If no conditions are specified, count displays the number of observations in the data.
How to count in R? Thank you.
stata commands to r
– Aulos