Hi I have the following data:
test=data.frame(Instrument=c(1,1,1,1,1),Code=c(278865100,NA,NA,278865101,NA),Date=c(2009,2010,2011,2012,2013))
I'd like to fill the first two NA rows with 278865100, and fill the last NA with 278865101. Basically, my goal is to fill NA with the most recent data for a specific instrument number.
Thank you!