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)

## Arguments

tab Simple table or ftable of which cell, row and column percentages as well as expected values are calculated. Tables of class xtabs and other will be coerced to ftable objects. Amount of digits for the table percentage values.

## Value

(Invisibly) returns a list with four tables:

1. cell a table with cell percentages of tab

2. row a table with row percentages of tab

3. col a table with column percentages of tab

4. expected a table with expected values of tab

## Examples

tab <- table(sample(1:2, 30, TRUE), sample(1:3, 30, TRUE))
# show expected values
table_values(tab)$expected #> A B C #> A 4 5 4 #> B 5 7 5 # show cell percentages table_values(tab)$cell
#>        1     2     3
#>
#> 1  16.67 10.00 13.33
#> 2  13.33 30.00 16.67