inspect_na: Find Out Which Columns Have Most NAs

Description Usage Arguments Value Examples

Description

Return the names and numbers of NAs of columns that have top # (refer to argument top) most NAs.

Usage

1
inspect_na(x, top=ncol(x))

Arguments

x

The data frame

top

The value of #.

Value

A named vector.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# building a data frame
A <- as.factor(c('y', 'x', 'x', 'y', 'z'))
B <- c(6, 3:6)
C <- 1:5
df <- data.frame(A, B, C)
df[3, 1] <- NA; df[2, 2] <- NA; df[4, 2] <- NA; df [5, 3] <- NA
print(df)

# inspection
a <- inspect_na(df)
print(a)

sherrisherry/cleandata documentation built on May 7, 2019, 5:02 a.m.