t. <- table(a,b) xtable(format(t.)) From: Ian Wilson <[EMAIL PROTECTED]> : : Any more elegant solutions to this? : : > a <- sample(c("a","d","c"),100,replace=T) : > b <- sample(c("d","e","f",100,replace=T) : > t <- table(a,b) : > xtable(t) : Error in xtable(t) : no applicable method for "xtable" : : The problem is that while t is a table (and : hence also a matrix) : : > is.matrix(t) : [1] TRUE : : data.frame(t) produces : : > data.frame(t) : a b Freq : 1 1 1 12 : 2 2 1 12 : 3 3 1 7 : 4 1 2 8 : 5 2 2 12 : 6 3 2 11 : 7 1 3 13 : 8 2 3 17 : 9 3 3 8 : : After a horrible solution, I have : ct <- apply(t,2,cbind); : rownames(ct) <- rownames(t); : xtable(ct) : : Is this a bug/feature, and if so how do I get round it? : : Ian Wilson :
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html