This article describes how to go from a standard table...
...to a table that shows the average across the rows and and average across the columns:
Two tables with matching rows and columns and a single statistic that you want to use for the calculation.
1. Select your table.
2. From the object inspector, copy the table's name from Properties > GENERAL > Name.
3. Go to Calculation > Custom Code.
4. Go to Properties > R CODE in the object inspector.
5. Add a line defining the table based on the name from Step 2, e.g.
6. Now paste in the below to calculate the averages and add them to the table:
attr.avg = colMeans(tab)
tab2 = rbind(tab,"Average" = attr.avg)
brand.avg = rowMeans(tab2)
new.tab = cbind(tab2,"Average" = brand.avg)
This code calculates the average for the columns via
colMeans and then adds this as a table row using
rbind. Next, it calculates the average of the rows via
rowMeans and then adds this as a table column using
7. Select this output and go to Properties > APPEARANCE > Number format to adjust decimal places and add a percentage sign.