groupcount: Generate 2D count table for two integer-valued vectors.

Description Usage Arguments Details Value Author(s) Examples

Description

Similar to 'table' function, this function builts a contingency table of the counts at each combination of all possible values from two integer-valued input vectors.

Usage

1
groupcount(g1, g2, n1, n2)

Arguments

g1

The first integer-valued input vector. The max value in g1 is n1.

g2

The second integer-valued input vector. The max value in g1 is n2.

n1

The maximum value in g1.

n2

The maximum value in g2.

Details

This is implemented as an utility function to build a 2D histogram count table. For efficiency, it does not check if the maximum values in input vectors exceed the maximum values specified.

Value

The count table.

Author(s)

Quanli Wang

Examples

1
2
3
4
5
n1 <- 20
n2 <- 10
g1 <- sample.int(n1,1000, replace = TRUE)
g2 <- sample.int(n2,1000, replace = TRUE)
counts <- groupcount(g1,g2,n1,n2)

NestedCategBayesImpute documentation built on May 2, 2019, 3:26 p.m.