expl_na: expl_na

Description Usage Arguments Value Note See Also Examples

View source: R/expl_na.R

Description

When given a dataframe object, this function will return a dataframe object with 1 row per variable with the sum of NA's. sorted alphabetically.

Usage

1
expl_na(df, na.strings = NULL, ignore.case = FALSE)

Arguments

df

dataframe

na.strings

Character - values to treat as NA

ignore.case

Logical - TRUE/FALSE as to whether na.strings should be case specific

Value

a dataframe containing the columns: var [Character]: variables from dataframe na [Integer]: count of missing values perc [Numeric]: percentage of that level

no columns: "no columns provided"

Note

an example for na.strings is c("NA", "Missing", "no_xml")

See Also

expl_categorical

Examples

1
2
3
4
5
6
7
df <- data.frame(pet = rep(c('dog', 'cat', 'Missing', 'Unknown'), c(40,30,20,10)),
                age = rep(c(1:9,NA),10),
                sex = rep(c('M','F', NA), c(50,30,20)),
                stringsAsFactors = FALSE)
expl_na(df)
expl_na(df, na.strings = c('Missing'))
expl_na(df, na.strings = c('unknown'), ignore.case = TRUE)

gloverd2/admr documentation built on Dec. 2, 2020, 11:16 p.m.