On Mon, 2009-07-27 at 16:34 -0300, Henrique Dallazuanna wrote: > Try this: > > t1 <- prop.table(table(factor(c(0,0,2,4,4), levels = 0:4))) > t2 <- prop.table(table(factor(c(0,2,2,2,3), levels = 0:4)))
Is there a way to do this given an already existing table? The problem is that I actually build the distributions as I read data from files, something like distr <- NULL for (file in files) { x <- as.matrix(read.table(file)) t <- c(distr, table(x)) distr <- tapply(t, names(t), sum) } distr <- prop.table(distr) So I only know the maximum level after the distributions are created. Thanks, Andre ______________________________________________ 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.