testDistribution: assert/check/test/Distribution

View source: R/assertions.R

testDistributionR Documentation

assert/check/test/Distribution

Description

Validation checks to test if a given object is a Distribution.

Usage

testDistribution(
  object,
  errormsg = paste(object, "is not an R6 Distribution object")
)

checkDistribution(
  object,
  errormsg = paste(object, "is not an R6 Distribution object")
)

assertDistribution(
  object,
  errormsg = paste(object, "is not an R6 Distribution object")
)

Arguments

object

object to test

errormsg

custom error message to return if assert/check fails

Value

If check passes then assert returns invisibly and test/check return TRUE. If check fails, assert stops code with error, check returns an error message as string, test returns FALSE.

Examples

testDistribution(5) # FALSE
testDistribution(Binomial$new()) # TRUE

distr6 documentation built on March 28, 2022, 1:05 a.m.