I have the following data frame (simplified) with the country variable as a factor and the value variable has missing values:
country value AUT NA AUT
A modern version of the ddply solution is to use the package dplyr:
ddply
dplyr
library(dplyr) DF %>% group_by(county) %>% mutate(value = na.locf(value, na.rm = F))