I have a data frame with 3 columns describing accounts:
Age, Users, and Cost
The Age column ranges from 1-20 and what I want to do is to calculate the average Cost by Age and divide that by Average Users by Age.
So for example, What is the average number of Users who are all Age 1 and what is the average Cost of accounts age 1.
The data frame is huge and I prefer not to just type in df = data[data$age_month == 1,] and then applying means to the columns 1 by 1.
Age  Users   Cost
1     2       5
2     15      7
2     124     10
2     43      100
3     232     21212
4     234     21212 
4     12      10000 
4     10      3
5     11      89
6     4       11
6     8       12
6     10      15
So I would want Mean of Cost column where Age = 1 divided by Mean of Users Column where Age = 1 and that for all Ages
Thanks in advance,
 
     
     
     
     
    