I have a dataframe with values for each age between 0 and 110 for each year between 1867 and now. As I don't know how to describe better my data I joined 2 printscreen of it.
For each year, I need to take the age corresponding to the median of the column "lx". lx is a column representing the number of survivors in a given population for each year starting from 100000. So for each year I need to take the age for which we had 50.000 survivors.
I have been trying this code but it doesn't work, it gives me only one value :
Median_Ages <-female.period.lifetable_1x1$Age[female.period.lifetable_1x1$lx == median(female.period.lifetable_1x1$lx) ]
Could someone help me to select the values I need?
Thanks in advance