This is similar to this dplyr lag post, and this dplyr mutate lag post, but neither of those ask this question about defaulting to the input value. I am using dplyr to muta
How about
ifelse(is.na(lag(value)), value, lag(value))