This function calculates a table's cell, row and column percentages as well as expected values and returns all results as lists of tables.
table_values(tab, digits = 2)
tab | Simple |
---|---|
digits | Amount of digits for the table percentage values. |
(Invisibly) returns a list with four tables:
cell
a table with cell percentages of tab
row
a table with row percentages of tab
col
a table with column percentages of tab
expected
a table with expected values of tab
tab <- table(sample(1:2, 30, TRUE), sample(1:3, 30, TRUE)) # show expected values table_values(tab)$expected#> A B C #> A 3 2 3 #> B 9 6 7# show cell percentages table_values(tab)$cell#> 1 2 3 #> #> 1 6.67 6.67 13.33 #> 2 33.33 20.00 20.00