Learn R Programming

formattable (version 0.1.5)

percent: Numeric vector with percentage representation

Description

Numeric vector with percentage representation

Usage

percent(x, digits, format = "f", ...)
"percent"(x, digits = 2L, format = "f", ...)
"percent"(x, digits = NA, format = "f", ...)

Arguments

x
a numeric vector.
digits
an integer to indicate the number of digits of the percentage string.
format
format type passed to formatC.
...
additional parameters passed to formattable.

Examples

Run this code
percent(rnorm(10, 0, 0.1))
percent(rnorm(10, 0, 0.1), digits = 0)
percent("0.5%")
percent(c("15.5%", "25.12%", "73.5"))

Run the code above in your browser using DataLab