I’d like replace NAs in my column with the last date entered for that ID. Below is the example for one ID=1: to convert DATE_old column to DATE_new column below:
DF =
ID DATE_old DATE_new
1 1/1/2018 1/1/2018
1 NA 1/1/2018
1 NA 1/1/2018
1 3/1/2018 3/1/2018
1 NA 3/1/2018
2 .....
I tried na.locf() which didn’t work:
DF$DATE_new <- ddply(DF$DATE_old, ~ID, na.locf)