Learn R Programming

gtsummary (version 0.1.0)

fmt_percent: Formats percentages to be displayed in tables or text of report.

Description

Formats percentages to be displayed in tables or text of report.

Usage

fmt_percent(x, symbol = FALSE)

Arguments

x

numeric vector of percentages

symbol

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

Value

Formatted 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)
fmt_percent(percent_vals)
fmt_percent(percent_vals, symbol = TRUE)
# }

Run the code above in your browser using DataLab