Skip to contents

Format numeric probabilities as text labels

Usage

prob_label(
  p,
  accuracy = 0.01,
  digits = NULL,
  max_digits = NULL,
  remove_leading_zero = TRUE,
  round_zero_one = TRUE
)

Arguments

p

numeric vector of probabilities

accuracy

accuracy of rounding

digits

Optional. Number of digits to round. Overrides accuracy parameter

max_digits

Optional. Maximum zeros or nines before rounding to 0 or 1

remove_leading_zero

Removes leading zero from probability

round_zero_one

Apply rounding to 0 and 1

Value

character vector

Examples

prob_label(seq(0,1, 0.1))
#>  [1] "0"   ".10" ".20" ".30" ".40" ".50" ".60" ".70" ".80" ".90" "1"