style_ratio | R Documentation |
When reporting ratios, such as relative risk or an odds ratio, we'll often
want the rounding to be similar on each side of the number 1. For example,
if we report an odds ratio of 0.95 with a confidence interval of 0.70 to 1.24,
we would want to round to two decimal places for all values. In other words,
2 significant figures for numbers less than 1 and 3 significant figures 1 and
larger. style_ratio()
performs significant figure-like rounding in this manner.
style_ratio(
x,
digits = 2,
big.mark = ifelse(decimal.mark == ",", " ", ","),
decimal.mark = getOption("OutDec"),
prefix = "",
suffix = "",
...
)
x |
( |
digits |
( |
big.mark |
( |
decimal.mark |
( |
prefix |
( |
suffix |
( |
... |
Arguments passed on to |
A character vector of styled ratios
Daniel D. Sjoberg
c(0.123, 0.9, 1.1234, 12.345, 101.234, -0.123, -0.9, -1.1234, -12.345, -101.234) |>
style_ratio()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.