Other questions using "table" in their title are actually using data frame.
I want to keep this strictly about table object.
Suppose I have tables with same structure that I want to find the average of.
For example:
test1 <- head(table(iris$Sepal.Length, iris$Species))
(test1 + test1 + test1) / 3
> (test1 + test1 + test1) / 3
setosa versicolor virginica
4.3 1 0 0
4.4 3 0 0
4.5 1 0 0
4.6 4 0 0
4.7 2 0 0
4.8 5 0 0
However, it cannot be done by:
> mean(c(test1,test1,test1))
[1] 0.8888889
> sum(c(test1,test1,test1)) / 3
[1] 16
Best approach I could find was to make the objects into a list of tables and use Reduce function:
Reduce(`+`, list(test1, test1, test1)) / 3
Is there more simpler way to do it without going back and forth using list object?