This function NAs by group in a data frame
Usage
count_group_na(data, vars = dplyr::everything(), group, format = "longer")
Arguments
- data
data frame
- vars
variables to be counted.
If no variables were provided, the function will count Missing Values for all variables.
- group
group variable
- format
output data frame format ('longer' or 'wider')
Note
Expected new features
Allowing more than one group variable.
Examples
tibble::tibble(
var1 = c(1,2,3,4, NA),
var2 = c(NA, NA, NaN, 2, 3),
group = c(2010,2010,2012,2012, 2012)
) -> data
count_group_na(data, group = group)
#> variable n group
#> 1 var2 2 2010
#> 2 var1 0 2010
#> 3 group 0 2010
#> 4 var1 1 2012
#> 5 var2 1 2012
#> 6 group 0 2012