Displaying 1 result from an estimated 1 matches for "d677cefb".
2010 Aug 23
2
Sum a list of tables
Hi all,
In R it is possible to sum tables:
> (a <- table(rep(1:3, sample(10,3))))
1 2 3
2 5 7
> a+a
1 2 3
4 10 14
Now suppose that I have a list of tables, where each table counts the
same things
> k <- list(a,a,a)
How can I sum all tables in k?
> do.call(sum, k)
[1] 42
does not work since it sums over each table.
> do.call(`+`, list(a,a))
1 2 3
4 10