There is a table with 3 columns
Id Food Sex
1       23       0
2       46       1
3       99       1
4       37       0
5       12       1
Now how do I get mean of food whose sex is marked as 1?
I have applied if(data$sex == 1)
To check the conditions but how do I select food column to get mean of food with the help of sex column
 
     
    