Skip to contents

Count missing values

Usage

count_missing(df, group_vars, x_var)

Arguments

df

A <data.frame> or <tibble>

group_vars

A <character> or <symbol> vector of the variables to group by

x_var

A <character> or <symbol> vector of the variable to count missing values for

Value

A <data.frame> or <tibble> with the count of missing values

Examples

dplyr::tibble(x = 1:10,
              y = 1:10,
              z = letters[1:10]) |>
              count_missing(z, x)
#> # A tibble: 10 × 2
#>    z     n_miss
#>    <chr>  <int>
#>  1 a          0
#>  2 b          0
#>  3 c          0
#>  4 d          0
#>  5 e          0
#>  6 f          0
#>  7 g          0
#>  8 h          0
#>  9 i          0
#> 10 j          0