algstat (version 0.0.2)

countTables: Count Similarly Margined Contingency Tables

Description

Count the number of contingency tables with the same marginals as a given table.

Usage

countTables(table, margins = as.list(1:length(dim(table))), dir = tempdir(), opts = "", quiet = TRUE)

Arguments

table
the table of interest
margins
the margins to be fixed
dir
directory to place the files in, without an ending /
opts
options for count
quiet
show latte output

Value

an integer

Details

countTables uses LattE's count function (via algstat's count function) to count the tables. In many cases, the number of such tables is enormous. In these cases, instead of giving back an integer countTables provides a character string with the integer in it; see examples.

See Also

count

Examples

Run this code
## Not run: 
# 
# 
# data(politics)
# countTables(politics)
# 
# data(handy)
# countTables(handy)
# 
# data(HairEyeColor)
# eyeHairColor <- margin.table(HairEyeColor, 2:1)
# countTables(eyeHairColor)
# 
# library(gmp)
# as.bigz(countTables(eyeHairColor))
# 
# 
# # notice that even tables with small cells can have
# # huge fibers
# data(drugs)
# countTables(drugs)
# 
# countTables(eyeHairColor, quiet = FALSE)
# 
# 
# 
# ## End(Not run)

Run the code above in your browser using DataLab