This function takes a `data.frame` object as an input and returns the corresponding `NA` counts. `NA` refers to R's builtin missing data holder.
get_na_counts(x, grouping_cols = NULL, exclude_cols = NULL)
A valid R `object` for which `na_counts` are needed.
A character vector. If supplied, one can provide the columns by which to group the data.
Columns to exclude from the analysis.
An object of the same type as `x` showing the respective number of missing values. If grouped is set to `TRUE`, the results are returned by group.
get_na_counts(airquality)
#> Ozone Solar.R Wind Temp Month Day
#> 1 37 7 0 0 0 0
# Grouped counts
test <- data.frame(Subject = c("A","A","B","B"), res = c(NA,1,2,3),
ID = c("1","1","2","2"))
get_na_counts(test,grouping_cols = c("ID", "Subject"))
#> # A tibble: 2 x 3
#> # Groups: ID [2]
#> ID Subject res
#> <chr> <chr> <int>
#> 1 1 A 1
#> 2 2 B 0