Returns share of NA values in vector by wrapping sum(is.na(x)) / length(x) and rounding the result

na_share(x, round = 2)

Arguments

x

Vector

round

Number of digits to round result to

Examples

x <- c(NA, 1, 2)
na_share(x)
#> [1] 0.33