Skip to contents

Create an enumeration to be used instead of arbitrary values in code.

Usage

enum(enumValues)

Arguments

enumValues

Values to use for the enum

Value

the Enum created

Examples

# Without predefined values
Color <- enum(c("Red", "Blue", "Green"))
myColor <- Color$Red

# With predefined values
Symbol <- enum(c(Diamond = 1, Triangle = 2, Circle = 2))
mySymbol <- Symbol$Diamond