Impute missing values of a count variable. Imputation is done by counting from the last known value. Example: c(NA,4,NA,NA) then becomes c(NA,4,NA,NA).

fill_missing_rownumber(x)

Arguments

x

Integer vector.

Value

Integer vector with filled values.

Examples

fill_missing_rownumber(c(NA,4,NA,NA))
#> [1] NA  4  5  6