It counts the number of missing (i.e.,`NA`) values in each column.

summarize_missing_values(
  data,
  cols = dplyr::everything(),
  group = NULL,
  verbose = TRUE,
  return_result = FALSE
)

Arguments

data

A data.frame or a data.frame extension (e.g. a tibble).

cols

Columns that need to be checked for missing values. See `dplyr::dplyr_tidy_select` for available options.

group

character. count missing values by group.

verbose

default is `TRUE`. Print the missing value data frame

return_result

default is `FALSE`. Return `data_frame` if set to yes

Value

An object of the same type as .data. that specified the number of NA values of the columns (only when `return_result = TRUE`)

Examples

df1 = data.frame(col1 = c(1,2,3),col2 = c(1,NA,3),col3 = c(1,2,NA))
summarize_missing_values(df1,everything())
#> # A tibble: 3 × 5
#>   var_name miss_count non_miss_count miss_perc non_miss_perc
#>   <chr>         <int>          <int> <chr>     <chr>        
#> 1 col1              0              3 0%        100%         
#> 2 col2              1              2 33.333%   66.667%      
#> 3 col3              1              2 33.333%   66.667%