A function to randomly generate arbitrary two-way tables
gen2wayTable(n = sample(100:500, size = 1), pmatrix = matrix(1:12, nrow = 3),
dmnames = list(X = paste("x", 1:nrow(pmatrix), sep = ""),
Y = paste("y", 1:ncol(pmatrix), sep = "")),
addmargins = TRUE, as.df = FALSE, untable = TRUE)
sum total observations
matrix of nonnegative weights for the probability distribution
names of the table dimensions
should margins be added?
table will be returned as a data frame
should counts be untabled to single observation per row
An object of class table containing the generated values.