I should preface this... I cannot use dplyr. It is just not installing in my version of R.
How would I do an action similar to a countifs
or sumifs
function in R?
P1 | P2 | Match | Same | count_of_friends
M | F | FALSE | FALSE| 6
M | M | TRUE | TRUE | 7
F | M | FALSE | FALSE| 10
F | F | TRUE | FALSE| 2
I would essentially be looking for something similar to EXCEL's
SUMIFS(Match == Same; count_of_friends)
I want to find the sum of friends if both individuals are of the same gender, or the sum of the counts of friends if the P1 is a Female.
I then also want to find out how to count only the instances where the count of friends is over 5, etc.
How would you do this in R?