-1

Here is the data I'm working with:

I want to replace all of the "NA_____"s with the most recent non "NA" value from the "FullName" column.

pogibas
  • 27,303
  • 19
  • 84
  • 117
M.J. Cox
  • 11
  • 2
  • 2
    Welcome to StackOverflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610). This will make it much easier for others to help you. – Jaap Dec 22 '17 at 12:08

1 Answers1

2

You can try na.locf from zoo:

library(zoo)
df$FullName <- na.locf(with(df, ifelse(FullName == "NA_____", NA, FullName)))
pogibas
  • 27,303
  • 19
  • 84
  • 117