sjstats (version 0.18.2)

table_values: Expected and relative table values

Description

This function calculates a table's cell, row and column percentages as well as expected values and returns all results as lists of tables.

Usage

table_values(tab, digits = 2)

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

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.

digits

Amount of digits for the table percentage values.

Examples

Run this code
tab <- table(sample(1:2, 30, TRUE), sample(1:3, 30, TRUE))
# show expected values
table_values(tab)$expected
# show cell percentages
table_values(tab)$cell

Run the code above in your browser using DataLab