• label_roche_pvalue() returns formatted p-values.

  • label_roche_percent() returns formatted percent values. This function only formats percentages between 0 and 1.

  • label_roche_ratio() returns formatted ratios with values below and above a threshold being returned as < 0.1 and > 999.9, for example, when digits=1.

style_roche_pvalue(
  x,
  big.mark = ifelse(decimal.mark == ",", " ", ","),
  decimal.mark = getOption("OutDec"),
  ...
)

label_roche_pvalue(
  big.mark = ifelse(decimal.mark == ",", " ", ","),
  decimal.mark = getOption("OutDec"),
  ...
)

style_roche_percent(
  x,
  digits = 1,
  prefix = "",
  suffix = "",
  scale = 100,
  big.mark = ifelse(decimal.mark == ",", " ", ","),
  decimal.mark = getOption("OutDec"),
  ...
)

label_roche_percent(
  digits = 1,
  suffix = "",
  scale = 100,
  big.mark = ifelse(decimal.mark == ",", " ", ","),
  decimal.mark = getOption("OutDec"),
  ...
)

style_roche_ratio(
  x,
  digits = 2,
  prefix = "",
  suffix = "",
  scale = 1,
  big.mark = ifelse(decimal.mark == ",", " ", ","),
  decimal.mark = getOption("OutDec"),
  ...
)

label_roche_ratio(
  digits = 2,
  prefix = "",
  suffix = "",
  scale = 1,
  big.mark = ifelse(decimal.mark == ",", " ", ","),
  decimal.mark = getOption("OutDec"),
  ...
)

Arguments

x

(numeric)
Numeric vector

big.mark

(string)
Character used between every 3 digits to separate hundreds/thousands/millions/etc. Default is ",", except when decimal.mark = "," when the default is a space.

decimal.mark

(string)
The character to be used to indicate the numeric decimal point. Default is "." or getOption("OutDec")

...

Arguments passed on to base::format()

digits

(non-negative integer)
Integer or vector of integers specifying the number of decimals to round x. When vector is passed, each integer is mapped 1:1 to the numeric values in x

prefix

(string)
Additional text to display before the number.

suffix

(string)
Additional text to display after the number.

scale

(scalar numeric)
A scaling factor: x will be multiplied by scale before formatting.

Value

A character vector of rounded p-values

Examples

# p-value formatting
x <- c(0.0000001, 0.123456)

style_roche_pvalue(x)
#> [1] "<0.0001" "0.1235" 
label_roche_pvalue()(x)
#> [1] "<0.0001" "0.1235" 

# percent formatting
x <- c(0.0008, 0.9998)

style_roche_percent(x)
#> [1] "<0.1"  ">99.9"
label_roche_percent()(x)
#> [1] "<0.1"  ">99.9"

# ratio formatting
x <- c(0.0008, 0.8234, 2.123, 1000)

style_roche_ratio(x)
#> [1] "<0.01"   "0.82"    "2.12"    ">999.99"
label_roche_ratio()(x)
#> [1] "<0.01"   "0.82"    "2.12"    ">999.99"