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.
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.
You can try na.locf
from zoo
:
library(zoo)
df$FullName <- na.locf(with(df, ifelse(FullName == "NA_____", NA, FullName)))