table_values: Expected and relative table values

View source: R/sjStatistics.R

table_valuesR Documentation

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)

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.

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
# show cell percentages
table_values(tab)$cell


sjPlot/sjstats documentation built on Nov. 20, 2022, 3:47 p.m.