Learn R Programming

prob (version 1.0-1)

genIndepTable: Generate Independent Two-way Table

Description

A function to generate a two-way table with independent margins

Usage

genIndepTable(n = sample(100:500, size = 1), prow = 1:3, pcol = 1:4, 
dmnames = list(X = paste("x", 1:length(prow), sep = ""), 
Y = paste("y", 1:length(pcol), sep = "")), addmargins = TRUE, 
as.df = FALSE, untable = TRUE)

Arguments

n

sum total of observations generated

prow

nonnegative weights for the row marginal distribution

pcol

nonnegative weights for the col marginal distribution

dmnames

names for the table dimensions

addmargins

should margins be added to the table

as.df

should the result be returned as a data frame

untable

if true then data frame will be expanded to one observation per row

Value

Either an object of class table or a data frame.

Details

This function will generate a two-way table with independent marginal distributions.