Steve,
Here is one approach that works. I am calling your first data frame "df".
# list all years from min to max observed in each ID
years <- tapply(df$Date, df$ID, function(x) min(x):max(x))
# create a data frame based on the observed range of years
fulldf <- data.frame(ID=rep(names(years), s
Hi folks,
I have this panel data (below), with observations missing in each of the
panels. I want to fill in years for the missing data, but only those years
within the span of the existing data. For instance, BC-0002 needs on year,
1995. I do not want any years after the last observation.
str
2 matches
Mail list logo