| print.spicy_freq_table | R Documentation |
freq() tables (spicy engine)Internal print method used by freq() to display a styled, spicy-formatted
frequency table in the console.
It formats valid, missing, and total rows; handles cumulative and valid
percentages; and appends a labeled footer including metadata such as
variable label, class, dataset name, and weighting information.
## S3 method for class 'spicy_freq_table'
print(x, ...)
x |
A
|
... |
Additional arguments (ignored, required for S3 method compatibility) |
This function is part of the spicy table rendering engine.
It is automatically called when printing the result of freq() with
styled = TRUE.
The output uses spicy_print_table() internally to render a colorized ASCII
table with consistent alignment and separators.
The printed table includes:
Valid and missing value sections (if applicable)
Optional cumulative and valid percentages
A final 'Total' row shown in the Category column
A footer summarizing metadata (variable label, data source, weights)
Invisibly returns x after printing the formatted table.
The printed table includes the following columns:
Category: Sections such as "Valid", "Missing", and "Total"
Values: Observed categories or levels
Freq.: Frequency count (weighted if applicable)
Percent: Percentage of total
Valid Percent: Percentage among valid values (optional)
Cum. Percent: Cumulative percentage (optional)
Cum. Valid Percent: Cumulative valid percentage (optional)
freq() for the main frequency table generator.
spicy_print_table() for the generic ASCII table renderer.
# Example using labelled data
library(labelled)
x <- labelled(
c(1, 2, 3, 1, 2, 3, 1, 2, NA),
labels = c("Low" = 1, "Medium" = 2, "High" = 3)
)
var_label(x) <- "Satisfaction level"
# Capture result without printing, then print explicitly
df <- spicy::freq(x, styled = FALSE)
print(df) # dispatches to print.spicy_freq_table()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.