Re: [R] Sum a list of tables

2010-08-23 Thread David Winsemius
On Aug 23, 2010, at 12:39 PM, Thaler, Thorn, LAUSANNE, Applied Mathematics wrote: Perfectly, works as expected. Regarding the other questions, can anybody point me to the right direction? So first question: where is the `+` operation defined for tables? tables are a modification vi

Re: [R] Sum a list of tables

2010-08-23 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
] Sum a list of tables Reduce(`+`, k) On Mon, Aug 23, 2010 at 12:18 PM, Thaler, Thorn, LAUSANNE, Applied Mathematics wrote: 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

Re: [R] Sum a list of tables

2010-08-23 Thread RICHARD M. HEIBERGER
sorry, cancel that. I will try again. On Mon, Aug 23, 2010 at 12:35 PM, RICHARD M. HEIBERGER wrote: > Reduce(`+`, k) > [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEA

Re: [R] Sum a list of tables

2010-08-23 Thread RICHARD M. HEIBERGER
Reduce(`+`, k) On Mon, Aug 23, 2010 at 12:18 PM, Thaler, Thorn, LAUSANNE, Applied Mathematics wrote: > 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, wher

[R] Sum a list of tables

2010-08-23 Thread Thaler, Thorn, LAUSANNE, Applied Mathematics
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