percentage of missings for each variable in a data.frame
miss_frac.Rd
This functions simply reports the number of missings as the percentage of the maximum number of rows. It also works on single variables.
Usage
miss_frac(df, vars = 1:NCOL(df))
Examples
fruits = c('apple', 'banana', NA, 'pear', 'pinapple', NA)
pets = c('cat', 'dog', 'anteater', NA, NA, NA)
favorites = data.frame(fruits, pets)
miss_frac(favorites)
#> fruits pets
#> 0.3333333 0.5000000
miss_frac(favorites$fruits)
#> [1] 0.3333333
miss_frac(favorites, 2)
#> [1] 0.5