check_proportion: Check for proportion

View source: R/checkmate.R

check_proportionR Documentation

Check for proportion

Description

[Experimental]

Check whether x is a (single) proportion.

Usage

check_proportion(x, null.ok = FALSE)

assert_proportion(
  x,
  null.ok = FALSE,
  .var.name = checkmate::vname(x),
  add = NULL
)

test_proportion(x, null.ok = FALSE)

expect_proportion(x, null.ok = FALSE, info = NULL, label = vname(x))

Arguments

x

an object to check.

null.ok

(flag)
whether x may also be NULL.

.var.name

(string)
name of the checked object to print in assertions; defaults to the heuristic implemented in checkmate::vname().

add

(AssertCollection or NULL)
collection to store assertion messages, see checkmate::AssertCollection.

info

(string)
extra information to be included in the message for the testthat reporter, see testthat::expect_that().

label

(string)
name of the checked object to print in messages. Defaults to the heuristic implemented in checkmate::vname().

Value

TRUE if successful, otherwise a string with the error message.

See Also

assertions for more details.

Examples

check_proportion(0.25)

insightsengineering/hermes documentation built on Sept. 19, 2024, 9:06 p.m.