inspect_par_bernoulli {inspector}R Documentation

Validate parameters for the Bernoulli/Binomial distributions

Description

inspect_par_bernoulli checks if an object is an eligible Bernoulli/Binomial proportion. This can be useful to validate inputs, intermediate calculations or outputs in user-defined functions.

Usage

inspect_par_bernoulli(x)

Arguments

x

An arbitrary object.

Details

inspect_par_bernoulli conducts a series of tests to check if x is an eligible Bernoulli/Binomial proportion. Namely, inspect_par_bernoulli checks if:

Value

inspect_par_bernoulli does not return any output. There are two possible outcomes:

See Also

Examples

# Calls that pass silently:
x <- 0.5
inspect_par_bernoulli(x)
inspect_par_bernoulli(0.1)

# Calls that throw an informative error message:
mylist <- list(
  NULL, TRUE, factor(.5), matrix(0.5), "0.5",
  list(0.5), NA, NaN, numeric(0), c(0.1, 0.5), -0.5, 1.1
)
try(inspect_par_bernoulli(mylist[[1]]))
try(inspect_par_bernoulli(mylist[[2]]))
try(inspect_par_bernoulli(mylist[[3]]))
try(inspect_par_bernoulli(mylist[[4]]))
try(inspect_par_bernoulli(mylist[[5]]))
try(inspect_par_bernoulli(mylist[[6]]))
try(inspect_par_bernoulli(mylist[[7]]))
try(inspect_par_bernoulli(mylist[[8]]))
try(inspect_par_bernoulli(mylist[[9]]))
try(inspect_par_bernoulli(mylist[[10]]))
try(inspect_par_bernoulli(mylist[[11]]))
try(inspect_par_bernoulli(mylist[[12]]))

[Package inspector version 1.0.3 Index]