I have an unbalanced panel with the following structure:
   Cntry  Year  Gini 
   AU     1980  NA
   AU     1981  NA
   AU     ...   NA
   AU     1985  0.409
   AU     1986  0.406
   AU     1989  0.41
   AU     ....
   AU     2001  0.45
   AU     2002  NA
   AU     2003  NA 
The other countries show similar pattern. As the Gini will be part of my dependent variable definition, what I would like to do is to interpolate the NAs so I can have Gini information for years in which I have observations on the controls.
What I tried first was to use the zoo package and the na.spline function to interpolate:
range_completed$gini_priY=na.spline(range_completed$gini_priY)
However, in this way it replace all the values in the Gini variable (for example the 0.409 in year 1985).
How can I solve this? Thank you!
 
     
    