z <- c(8, NA, 9, NA, 3)
ZeroIfNA(z)
# [1] 8 0 9 0 3
# set 8 and 9 to NA
NAIf(ZeroIfNA(z), what=c(8, 9))
Impute(z)
# [1] 8 8 9 8 3
z <- c("a", NA, "", NA, "k")
BlankIfNA(z)
# [1] "a" "" "" "" "k"
Run the code above in your browser using DataLab