I have a matrix
sex age height weight
[1,] 2 6 110 22
[2,] 1 2 84 12
[3,] 2 2 85 10
[4,] 1 6 108 20
[5,] 2 4 100 18
[6,] 1 4 98 16
How do I calculate mean height for sex = 2 (girls) It should be simple but I can't find the answer.