groupcount {NestedCategBayesImpute}R Documentation

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

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

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

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

[Package NestedCategBayesImpute version 1.2.1 Index]