Re: [R] time-series data and time-invariant missing values

2009-04-06 Thread Gabor Grothendieck
Check out na.locf in the zoo package. Here we fill in NAs going forward and just in case there were NAs right at the beginning we fill them in backward as well. library(zoo) x <- as.Date(c(NA, "2000-01-01", NA)) x2 <- na.locf(x, na.rm = FALSE) x2 <- na.locf(x2, fromLast = TRUE, na.rm = FALSE) gi

[R] time-series data and time-invariant missing values

2009-04-06 Thread Kunzler, Andreas
Dear list, I have some problems with time-series data and missing values of time-invariant informations like sex or the birth-date. Assume a data (d) structure like id birth sex year of observation 1 NA NA 2006 1 1976-01-01 male2007 1