inspect_na()
summarizes the rate of missingness in each column of a data frame. For a grouped data frame, the rate of missingness is summarized separately for each group.
Details
The tibble returned contains the columns:
col_name, a character vector containing column names of df1.
cnt, an integer vector containing the number of missing values by column.
pcnt, the percentage of records in each columns that is missing.
Examples
library(dplyr)
# dataframe summary
inspect_na(airquality)
#> # A tibble: 6 × 3
#> col_name cnt pcnt
#> <chr> <int> <dbl>
#> 1 Ozone 37 24.2
#> 2 Solar.R 7 4.58
#> 3 Wind 0 0
#> 4 Temp 0 0
#> 5 Month 0 0
#> 6 Day 0 0
# grouped dataframe summary
airquality %>%
group_by(Month) %>%
inspect_na()
#> # A tibble: 25 × 4
#> # Groups: Month [5]
#> Month col_name cnt pcnt
#> <int> <chr> <int> <dbl>
#> 1 5 Ozone 5 16.1
#> 2 5 Solar.R 4 12.9
#> 3 5 Wind 0 0
#> 4 5 Temp 0 0
#> 5 5 Day 0 0
#> 6 6 Ozone 21 70
#> 7 6 Solar.R 0 0
#> 8 6 Wind 0 0
#> 9 6 Temp 0 0
#> 10 6 Day 0 0
#> # ℹ 15 more rows