Learn R Programming

gtsummary (version 1.2.1)

style_percent: Style percentages to be displayed in tables or text

Description

Style percentages to be displayed in tables or text

Usage

style_percent(x, symbol = FALSE)

Arguments

x

numeric vector of percentages

symbol

Logical indicator to include percent symbol in output. Default is FALSE.

Value

A character vector of styled percentages

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab