i have a data table and i would like to insert new rows imputing values between two years. This will be done over many ID groups. how do i go about replicating the data into the new rows?
# data table
dt <- data.table(ID=c(rep(1:3,each=3)),
attrib1=rep(c("sdf","gghgf","eww"),each=3),
attrib2=rep(c("444","222","777"),each=3),
Year = rep(c(1990, 1995, 1996), 3),
value = c(12,6,7,6,3,1,9,17,18))
so for all groups (ID), Year would go from 1990 to 1996 and the 2 values for 1990 & 1995 would be imputed linearly. All other attributes would remain the same and be copied into the new rows.
i've done this with a hideously long work around and attempted a custom function, but to no avail