Assertion for controlling object, argument, and return types. Allows for the type checking of enums and enum members.

This function requires the typed package to operate. See typed::?() for more details.

Enum(...)

Arguments

...

a value to check type assertions with

Value

any

Examples

# If you leverage the {typed} package, you can make use # of the `Enum()` assertion for type checking: library(typed, quietly = TRUE, warn.conflicts = FALSE) # Variable 'x' must correspond to an enum Enum() ? x <- enum(a, b, c) # Variable 'x' must correspond to a variable in an enum Enum(enum(a, b, c)) ? x <- 2 # Argument 'x' must correspond to a variable in an enum my_function <- ? function(x = ? Enum(enum(a, b, c))) { print("success!") } # Function must return an enum func_return <- Enum() ? function() { return( enum(a, b, c) ) }