gen2wayTable: Generate Two-way Tables

View source: R/genData.R

gen2wayTableR Documentation

Generate Two-way Tables

Description

A function to randomly generate arbitrary two-way tables.

Usage

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
)

Arguments

n

sum total observations

pmatrix

matrix of nonnegative weights for the probability distribution

dmnames

names of the table dimensions

addmargins

should margins be added?

as.df

table will be returned as a data frame

untable

should counts be untabled to single observation per row

Value

An object of class table containing the generated values.

Author(s)

G. Jay Kerns


probs documentation built on June 22, 2024, 10:41 a.m.