Access enum members through subsetting with numeric or character indices.
Enums are converted to a list type through the
as.list
method, before being subset by an index.
Partial matching via [
, [[
, or $
is not supported, and will return
NULL. This is intended to incentivise literate programming, as partial
matching can lead to errors.
Enums are not intended to be used as interactive data structures.
Assigning to enum members is not supported, and will
throw an error if attempted. If you require an enum to be modifiable,
consider using a list
instead.
# S3 method for enum [(x, arg) # S3 method for enum [[(x, arg) # S3 method for enum $(x, arg) # S3 method for enum $(x, arg) <- value # S3 method for enum [(x, arg) <- value # S3 method for enum [[(x, arg) <- value
x | enum to subset |
---|---|
arg | value to subset enum with, generally the indices of the enum |
value | assigning values to enums is not allowed |
#> $a #> [1] 1 #>a[[1]]#> [1] 1a$a#> [1] 1