Fill all missing values for an interval observed in the vector

fill_missing_interval(x, min_known_n = NULL, min_known_p = NULL)

Arguments

x

The vector to fill

min_known_n

numeric value: the minimum number of not-missing values

min_known_p

numeric value between 0 and 1: the minimum fraction of not-missing values

Value

a filled vector

Examples

fill_missing_interval(c(NA, 1, 2, NA))
#> [1] 0 1 2 3
fill_missing_interval(c(NA, 10, 20, NA))
#> [1]  0 10 20 30