[R] producing a master table from list of tables
david.schruth
dschruth at gmail.com
Thu Dec 31 21:37:05 CET 2009
Hello,
I'm trying to construct an overall summary table from a list of
tables.
my.list <- list(x=c('a','b','a','b','c'), y=c
('a','d','c','a','b','d'),z=c('d','d','c'))
my.table.list <- lapply(my.list, table)
normally this might be really easy:
master.table <- table(unlist(my.list))
But as it turns out I'm writing a function which allows the passing of
the table list in the form of 'my.table.list' above and I don't have
access to the 'my.list' form. Does anybody know of an elegant way to
make 'master.table' without too much code or direct reconstruction of
'my.list' (e.g. the following line)
my.list <- lapply(my.table.list, function(x) rep(names(x),x))
Thanks in advance,
Dave
More information about the R-help
mailing list