Skip to contents

[Stable]

This function counts NAs in a data frame for each variable

Usage

count_na(data, format = "longer")

Arguments

data

data frame

format

output data frame format ('longer' or 'wider')

Examples

tibble::tibble(
var1 = c(1,2,3,4, NA),
var2 = c(NA, NA, NaN, 2, 3)
) -> data
count_na(data)
#>   variable n
#> 1     var2 3
#> 2     var1 1
count_na(data, "wider")
#>   var2 var1
#> 1    3    1