By the "null distribution" do you mean that the assignment of each observation to a column is equal? If so, the function sample() might serve your needs. For example:
rows <- 3 cols <- 4 rowtot <- 100 m <- matrix(NA, nrow=rows, ncol=cols) for(i in seq(rows)) { m[i, ] <- tabulate(sample(seq(cols), rowtot, replace=T)) } m [,1] [,2] [,3] [,4] [1,] 27 24 25 24 [2,] 19 24 26 31 [3,] 26 26 31 17 Jean Jim Silverton wrote on 08/29/2011 01:14:28 AM: > > Hi all, > I have a 3x4 contingency table with row totals all being 100. I want to > generate 3 x 4 tables from the null distribution. Which R function can do > this? > > -- > Thanks, > Jim. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.