i wish to calculate the mean of a column given the condition of another column
For example, Mean of Column 2 when Column 1 = Male That would mean: (69+55+60)/3
However, i am not too sure how to use the command.
This is my code: mean(Column2[,2](which(Column1[,1]=="M")))
Please kind advise thank you!
Also, i attached a simplified version of the data that i am doing.
enter image description here