count_NAs: Prints count(s) of missing values

Description Usage Arguments Value Examples

View source: R/data.table_misc.R

Description

Prints count(s) of missing values (coded as NA) in an object (vector, data.frame, data.table etc.).

Usage

1
count_NAs(data_in, prop = FALSE, print = TRUE)

Arguments

prop

Flag indicating if results should include proportions.

print

Flag indicating if results should be printed.

data

Input object.

Value

Table with counts (and proportions if TRUE) of missing values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
dt <- data.table::data.table(a = rnorm(n=1000, mean=20, sd=5),
                             b = rnorm(n=1000, mean=20, sd=5),
                             c = rnorm(n=1000, mean=20, sd=5))
dt[sample.int(nrow(dt), round(nrow(dt) * 0.15)), a := NA_real_]
count_NAs(dt)
count_NAs(dt, prop = TRUE)
count_NAs(dt[, a])
count_NAs(dt[, a], prop = TRUE)
count_NAs(dt[, .(a)])
count_NAs(dt[, .(a)], prop = TRUE)

m-dz/mdmisc documentation built on May 22, 2019, 12:23 p.m.