Helper function to create an S7 property with a limited set of valid options.
new_options_property(
class = S7::class_any,
options,
default = options[[1]],
name = NULL
)An S7 property object with validation for allowed options
The S7 class for the property (default: S7::class_any)
Character vector of valid options for the property
Default value for the property (default: first option)
Optional name for the property
# Create a property that only accepts specific values # color_prop <- new_options_property(options = c("red", "blue", "green"))