style_percent {gtsummary} | R Documentation |
Style percentages
Description
Style percentages
Usage
style_percent(
x,
symbol = FALSE,
digits = 0,
big.mark = ifelse(decimal.mark == ",", " ", ","),
decimal.mark = getOption("OutDec"),
...
)
Arguments
x |
numeric vector of percentages |
symbol |
Logical indicator to include percent symbol in output.
Default is |
digits |
number of digits to round large percentages (i.e. greater than 10%).
Smaller percentages are rounded to |
big.mark |
( |
decimal.mark |
( |
... |
Arguments passed on to |
Value
A character vector of styled percentages
Author(s)
Daniel D. Sjoberg
Examples
percent_vals <- c(-1, 0, 0.0001, 0.005, 0.01, 0.10, 0.45356, 0.99, 1.45)
style_percent(percent_vals)
style_percent(percent_vals, symbol = TRUE, digits = 1)
[Package gtsummary version 2.0.0 Index]