cr_table: Calculates conversion ratio table with counts and proportions

Description Usage Arguments Examples

View source: R/modelling_misc.R

Description

Calculates conversion ratio table with counts and proportions

Usage

1
cr_table(dt, cols, target, order = "cols", prop_count = TRUE)

Arguments

order

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
n <- 200
sample_dt <- data.table::data.table(
  ColA = sample(letters[1:5], n, replace = TRUE),
  ColB = sample(letters[1:5], n, replace = TRUE),
  Target = runif(n) <= 0.1)

cr_table(sample_dt, 'ColA', 'Target', prop_count = FALSE)
cr_table(sample_dt, 'ColA', 'Target', prop_count = TRUE)
cr_table(sample_dt, 'ColA', 'Target')

cr_table(sample_dt, c('ColA','ColB'), 'Target')
cr_table(sample_dt, c('ColA','ColB'), 'Target', order = 'cr')
cr_table(sample_dt, c('ColA','ColB'), 'Target', order = 'count')
cr_table(sample_dt, c('ColA','ColB'), 'Target', order = 'prop')

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