count_values: Prints count(s) of specified values

Description Usage Arguments Value Examples

View source: R/data.table_misc.R

Description

Prints count(s) of specified values in a data.table object.

Usage

1
2
count_values(dt_in, value = "", prop = FALSE, na.rm = TRUE,
  print = TRUE)

Arguments

print

Value

Table with counts (and proportions if TRUE) of specified 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 := -Inf]
count_values(dt)
count_values(dt, prop = TRUE)
count_values(dt, -Inf)
count_values(dt, -Inf, prop = TRUE)

TODO: Write tests

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