build_table: Complete contingency tables for count and prevalence-based...

View source: R/build_table.R

build_tableR Documentation

Complete contingency tables for count and prevalence-based factors

Description

build_table() completes partially-specified contingency tables using simple arithmetic.

Usage

build_table(timber, low_cell_correction = 0.5, low_cell_threshold = 0)

Arguments

timber

a tibble of timber.

low_cell_correction

numeric: the value added to all cells when one or more is at or below the low_cell_threshold.

low_cell_threshold

numeric: the threshold at or below which the low_cell_correction is applied to all cells.

Details

A complete contingency table (counts in cells A, B, C, and D) is required to calculate measures of association for count or prevalence-based data. Depending on the factor's grain, the set of fields used to complete the table differs. Simple arithmetic is used to complete the table. The fields included in each grain are described in check_grain.

When any cells in the table are less than or equal to the low_cell_threshold, a low_cell_correction is added to each cell, and the correction is noted in the low_cell_count column.

Where both positive cells (A and C) are zero, the factor represents a null comparison, and the null comparison is noted in the null_comparison column.

Value

A tibble of timber, with complete A, B, C, and D columns for count and prevalence-based factors, and additional columns: low_cell_count, and null_comparison.


iAM-AMR/sawmill documentation built on June 30, 2024, 2:25 a.m.