Learn R Programming

GimmeMyStats (version 1.0.0)

print_binomial: Prints descriptive statistics for binomial variables

Description

Calculates and prints frequency counts and percentages for binomial (two-level) categorical variables.

Usage

print_binomial(x, digits = 1, width = 15)

Value

A tibble with one row per level for each categorical level containing the following columns:

Variables

Character vector specifying the name of each variable.

Levels

Character vector specifying the category level for each variable.

Statistics

Character vector combining the frequency count and the percentage for each level.

Arguments

x

Data frame, matrix, or vector containing binomial variables.

digits

Integer specifying the number of decimal places for the test statistic.

width

Integer specifying the maximum width for wrapping text.

Examples

Run this code
x <- data.frame(A = sample(c("X", "Y"), 100, replace = TRUE))
print_binomial(x)
print_binomial(x, digits = 2, width = 5)

Run the code above in your browser using DataLab