I am trying to fill in blank values using R just as I would using excel to fill blank cells in a series with linear values. I am trying to get R to fill in the med_age for the dates between 1940 and 1950, 1950 and 1960 in a linear fashion based on the med_age above and below the missing values.
obs = seq(1,79,1)
date = (seq(1940,2018,1))
med_age_data = data.frame(obs, date)
med_age_data$med_age <- replace(med_age_data$med_age, med_age_data$date == "1940", "29")
med_age_data$med_age <- replace(med_age_data$med_age, med_age_data$date == "1950", "30.2")
med_age_data$med_age <- replace(med_age_data$med_age, med_age_data$date == "1960", "29.5")
med_age_data$med_age <- replace(med_age_data$med_age, med_age_data$date == "1970", "30")
med_age_data$med_age <- replace(med_age_data$med_age, med_age_data$date == "1980", "30")
med_age_data$med_age <- replace(med_age_data$med_age, med_age_data$date == "1990", "32.9")
med_age_data$med_age <- replace(med_age_data$med_age, med_age_data$date == "2000", "35.3")
med_age_data$med_age <- replace(med_age_data$med_age, med_age_data$date == "2010", "37.2")