Skip to contents

[Stable]

Formats a fraction together with ratio in percent.

Usage

format_fraction(x, ...)

Arguments

x

(integer)
with elements num and denom.

...

required for rtables interface.

Value

a string in the format num / denom (ratio %). If num is 0 the format is num / denom.

Examples

format_fraction(x = c(num = 2L, denom = 3L))
#> [1] "2/3 (66.7%)"
format_fraction(x = c(num = 0L, denom = 3L))
#> [1] "0/3"