No, that's basically the solution I had already come up with (see the
last line of code from my original post)

but, Yes, I'm thinking this might be the simplest way (even though it
might not scale well to millions of elements )

On Dec 31, 1:17 pm, Dennis Murphy <[email protected]> wrote:
> Hi,
>
> Is this what you wanted?
>
> untable <- function(tab) rep(names(tab), as.vector(tab))
> lapply(my.table.list, untable)
> $x
> [1] "a" "a" "b" "b" "c"
>
> $y
> [1] "a" "a" "b" "c" "d" "d"
>
> $z
> [1] "c" "d" "d"
>
> HTH,
> Dennis
>
>
>
> On Thu, Dec 31, 2009 at 12:37 PM, david.schruth <[email protected]> wrote:
> > 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
>
> > ______________________________________________
> > [email protected] 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.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [email protected] mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

______________________________________________
[email protected] 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.

Reply via email to