Re: [R] Panel Data--filling in missing dates in a span only

2015-03-11 Thread Adams, Jean
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

[R] Panel Data--filling in missing dates in a span only

2015-03-10 Thread Steven Archambault
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