Learn R Programming

NestedCategBayesImpute (version 1.2.1)

groupcount: 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.

Value

The count table.

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.

Examples

Run this code
# NOT RUN {
n1 <- 20
n2 <- 10
g1 <- sample.int(n1,1000, replace = TRUE)
g2 <- sample.int(n2,1000, replace = TRUE)
counts <- groupcount(g1,g2,n1,n2)
# }

Run the code above in your browser using DataLab