Takes a data frame or tabyl and formats it to display counts (N)
and percentages combined into a single string cell (e.g., "12 (34.3%)").
adorn_np(x, denom = c("row", "col", "all"), digits = 1, trim = TRUE)A data frame or tabyl containing frequency data.
A character string specifying the direction for percentage
calculation. Must be one of "row" (default), "col", or "all".
An integer specifying the number of decimal places to display
for percentages. Default is 1.
A logical scalar. If TRUE (default), trims and collapses
whitespace in the output strings using str_squish.
If FALSE, preserves padding created by formatting.
A data frame (or tabyl) of character columns where each entry
combines the raw count and percentage in the format "N (X.X%)".
This function chains together several janitor package helpers:
adorn_percentages to calculate relative proportions.
adorn_pct_formatting to convert proportions to
formatted percentage strings rounded "half up".
adorn_ns to attach the raw counts (N) to
the front of each formatted percentage string.