Learn R Programming

sjmisc (version 1.0.2)

table_values: Compute 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
A simple table or ftable of which cell, row and column percentages as well as expected values are calculated. Tables of class
digits
The amount of digits for the table percentage values.

Value

  • (invisibly) returns a list with four tables:
    1. cella table with cell percentages oftab
    2. rowa table with row percentages oftab
    3. cola table with column percentages oftab
    4. expecteda table with expected values oftab

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