# as_pb: Display a percentage as a (rounded) probability. In riskyr: Rendering Risk Literacy more Transparent

## Description

`as_pb` is a function that displays a percentage `perc` as a probability (rounded to `n.digits` decimals).

## Usage

 `1` ```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: `n.digits = 4`.

## 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).

`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`

Other display functions: `as_pc`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```as_pb(1/3) # => 0.0033 as_pb(as_pc(2/3)) # => 0.6667 (rounded to 4 decimals) prob.seq <- seq(0, 1, by = 1/10) perc.seq <- seq(0, 100, by = 10) as_pc(prob.seq) # => 0 10 20 30 40 50 60 70 80 90 100 as_pb(perc.seq) # => 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 perc.seq == as_pc(as_pb(perc.seq)) # => all TRUE prob.seq == as_pb(as_pc(prob.seq)) # => some FALSE due to rounding errors! round(prob.seq, 4) == as_pb(as_pc(prob.seq)) # => all TRUE (both rounded to 4 decimals) ```

riskyr documentation built on Feb. 19, 2018, 5 p.m.