I am brand new to R, I need to calculate the mean age for an entire population. I have filtered my data frame down to two columns 'Age' and 'Population' and it looks like this:
0 - 10,178
1 - 22,826
2 - 15,836
3 - 27,196
4 - 32,105
The age range is 0-55, and I am not clear on how to best calculate this.
mean(df$age) just give me the mean of the 0-55, ie 27.5, so not sure how to bring in the population values.
Really appreciate any guidance on this, I am getting the feeling I am not approaching this from the right angle.