missingness: Find missingness in each column and search for strings that...

Description Usage Arguments Value See Also Examples

View source: R/missingness.R

Description

Finds the percent of NAs in a vector or in each column of a dataframe or matrix or in a vector. Possible mis-coded missing values are searched for and a warning issued if they are found.

Usage

1
2
missingness(d, return_df = TRUE, to_search = c("NA", "NAs", "na", "NaN",
  "?", "??", "nil", "NULL", " ", ""))

Arguments

d

A data frame or matrix

return_df

If TRUE (default) a data frame is returned, which generally makes reading the output easier. If variable names are so long that the data frame gets wrapped poorly, set this to FALSE.

to_search

A vector of strings that might represent missingness. If found in d, a warning is issued.

Value

A data frame with two columns: variable names in d and the percent of entries in each variable that are missing.

See Also

plot.missingness

Examples

1
2
3
4
5
d <- data.frame(x = c("a", "nil", "b"),
                y = c(1, NaN, 3),
                z = c(1:2, NA))
missingness(d)
missingness(d) %>% plot()

healthcareai documentation built on Sept. 2, 2018, 1:03 a.m.