Description Usage Arguments Details Value See Also Examples
enum()
creates a new enumeration, and infers the the enumeration type
based on the arguments supplied to it. Enumerations are similar to lists,
but:
cannot be assigned to after definition
all values and names must be unique
There are two types of enumeration: generic and numeric. The main difference between the two is that generic enumerations must have all their values explicitly defined. Numeric enums, by contrast, infer the values of their members, and must have only numeric values.
Numeric enum values are inferred when a member does not have a value assigned to it. The value of the member is then calculated as +1 to the last member's value, or the current member's index. Incrementation for values is prioritised over index as value.
1 |
... |
list of enumeration arguments |
Under the surface, enums are actually lists contained within
locked environments. This is so that the enum bindings cannot be modified,
and the enum order is maintained. S3 methods are defined for
$
, [
, and [[
, which access the enum list directly.
An enumeration (enum), a list of unique name/value pairs.
new_numeric_enum()
, new_generic_enum()
, as_enum()
1 2 3 4 5 6 7 8 9 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.