# is_prob

0th

Percentile

##### Verify that input is a probability (numeric value from 0 to 1).

is_prob is a function that checks whether its argument prob is a probability (i.e., a numeric value in the range from 0 to 1).

##### Usage
is_prob(prob, NA_warn = FALSE)
##### Arguments
prob

A numeric argument (scalar or vector) that is to be checked.

NA_warn

Boolean value determining whether a warning is shown for NA values. Default: NA_warn = FALSE.

##### Value

A Boolean value: TRUE if prob is a probability, otherwise FALSE.

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; is_valid_prob_set verifies the validity of probability inputs; as_pc displays a probability as a percentage; as_pb displays a percentage as probability.

Other verification functions: is_complement, is_extreme_prob_set, is_freq, is_perc, is_suff_prob_set, is_valid_prob_pair, is_valid_prob_set, is_valid_prob_triple

• is_prob
##### Examples
# NOT RUN {
# ways to succeed:
is_prob(1/2)                  # => TRUE
p.seq <- seq(0, 1, by = .1)   # Vector of probabilities
is_prob(p.seq)                # => TRUE (for vector)

## watch out for:
# is_prob(NA)                   # => FALSE + NO warning!
# is_prob(0/0)                  # => FALSE + NO warning (NA + NaN values)
# is_prob(0/0, NA_warn = TRUE)  # => FALSE + warning (NA values)

## ways to fail:
# is_prob(8, NA_warn = TRUE)         # => FALSE + warning (outside range element)
# is_prob(c(.5, 8), NA_warn = TRUE)  # => FALSE + warning (outside range vector element)
# is_prob("Laplace", NA_warn = TRUE) # => FALSE + warning (non-numeric values)

# }

Documentation reproduced from package riskyr, version 0.2.0, License: GPL-2 | GPL-3

### Community examples

Looks like there are no examples yet.