you can use combn to create the combinations and the following will create a list of all the results:
x1 <- x2 <- x3 <- x4 <- 1:10 comb <- combn(c('x1','x2', 'x3', 'x4'), 2) myTab <- lapply(seq(ncol(comb)), function(x){ table(get(comb[1, x]), get(comb[2, x])) }) # put names of the combinations names(myTab) <- apply(comb, 2, paste, collapse=":") On Thu, Jan 29, 2009 at 4:19 AM, Gerit Offermann <gerit.offerm...@gmx.de> wrote: > Dear list, > > I have a set of 100+ variables. I would like to have one by one crosstables > for each variable. I started with > table(variable1, variable2) > table(variable1, variable3) > table(variable1, variable4) > ... > table(variable2, variable3) > table(variable2, variable4) > ... > > It seems rather tedious. > > Any better ideas around? > > Thanks for any help! > Gerit > -- > NUR NOCH BIS 31.01.! GMX FreeDSL - Telefonanschluss + DSL > für nur 16,37 EURO/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a > > ______________________________________________ > 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. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? ______________________________________________ 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.