Learn R Programming

sicher (version 0.1.0)

Enum: Enum Type Factory

Description

Creates an enumeration type using regular function call syntax. The resulting type only accepts atomic vectors whose elements all belong to the declared set of allowed values.

Usage

Enum(...)

Value

A new sicher_type that checks all values belong to the enum.

Arguments

...

Allowed scalar values or a single atomic vector of allowed values.

Examples

Run this code
status %:% Enum(1, 2, 3) %<-% 2
colors %:% Enum("red", "green", "blue") %<-% c("red", "blue")
try(colors <- c("yellow", "red"))

Run the code above in your browser using DataLab