I have this vector myvec
. I want to remove all the NAs and replace them with the preceding items and get the result.
myvec
c("AMLM12001KP", NA, "1114002", NA, "1121501", NA, "1231401",
NA, NA, NA)
result
AMLM12001KP AMLM12001KP 1114002 1114002 1121501 1121501 1231401
1231401 1231401 1231401