get_na_counts: Add columnwise/groupwise counts of missing values

Description Usage Arguments Value Examples

View source: R/get_na_counts.R

Description

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.

Usage

1
get_na_counts(x, grouping_cols = NULL, exclude_cols = NULL)

Arguments

x

A valid R 'object' for which 'na_counts' are needed.

grouping_cols

A character vector. If supplied, one can provide the columns by which to group the data.

exclude_cols

Columns to exclude from the analysis.

Value

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.

Examples

1
2
3
4
5
get_na_counts(airquality)
# 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"))

mde documentation built on Feb. 10, 2022, 5:08 p.m.

Related to get_na_counts in mde...