pretty_percent: Format Numeric Variables as Percentages
Description
This function formats numeric variables as percentages with a specified
number of decimal places. It refines the output by removing unnecessary
trailing zeros after the decimal point and ensures the percentage sign is
correctly applied without extraneous characters, resulting in a polished,
human-readable percentage representation.
Usage
pretty_percent(variable, n_decimal = 1)
Value
A character vector containing the formatted percentages.
Arguments
variable
A numeric vector representing proportions to format as
percentages. The values are on a scale from 0 to 1.
n_decimal
A numeric value specifying the number of decimal places.
Defaults to 1.