fast_crosstable: 2d cross-tabulation

Description Usage Arguments Details Value Note Examples

View source: R/utilities.R

Description

Quickly cross-tabulates two binary vectors.

Usage

1
fast_crosstable(target, len_target, pos_target, feature)

Arguments

target

target.

len_target

length of the target vector.

pos_target

number of positive cases in the target vector.

feature

feature vector.

Details

Input looks odd, but the function was build to be fast subroutine of calc_ig, which works on many features but only one target.

Value

a vector of length four:

  1. target +, feature+

  2. target +, feature-

  3. target -, feature+

  4. target -, feature-

Note

Binary vector means a numeric vector with 0 or 1.

Examples

1
2
3
tar <- sample(0L:1, 100, replace = TRUE)
feat <- sample(0L:1, 100, replace = TRUE)
fast_crosstable(tar, length(tar), sum(tar),  feat)

biogram documentation built on March 31, 2020, 5:14 p.m.