get_na_counts: Add columnwise/groupwise counts of missing values

View source: R/get_na_counts.R

get_na_countsR Documentation

Add columnwise/groupwise counts of missing values

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

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

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"))

Nelson-Gon/mde documentation built on March 23, 2022, 10:58 p.m.