Replace NAs randomly from a selected range with replacement
replace_na_range(x, range)
Arguments
- x
Original numeric vector containing missing values.
- range
Vector specifying the valid values to replace the missing values with
Examples
replace_na_range(c(1,NA,2,3,1,NA,2),c(1,2,3))
#> [1] 1 3 2 3 1 3 2