as_pb {riskyr} | R Documentation |
Display a percentage as a (numeric and rounded) probability.
Description
as_pb
is a function that displays a percentage perc
as a probability (rounded to n_digits
decimals).
Usage
as_pb(perc, n_digits = 4)
Arguments
perc |
A percentage (as a scalar or vector of numeric values from 0 to 100). |
n_digits |
Number of decimal places to which percentage is rounded.
Default: |
Details
as_pb
and its complement function as_pc
allow
toggling the display of numeric values between percentages and probabilities.
Value
A probability (as a numeric value).
See Also
is_perc
verifies a percentage;
is_prob
verifies a probability;
is_valid_prob_set
verifies the validity of probability inputs;
num
contains basic numeric variables;
init_num
initializes basic numeric variables;
prob
contains current probability information;
comp_prob
computes current probability information;
freq
contains current frequency information;
comp_freq
computes current frequency information;
comp_complement
computes a probability's complement;
comp_comp_pair
computes pairs of complements.
Other utility functions:
as_pc()
,
plot.box()
Other display functions:
as_pc()
Examples
as_pb(1/3) # => 0.0033
as_pb(as_pc(2/3)) # => 0.6667 (rounded to 4 decimals)