Learn R Programming

myTAI (version 2.3.4)

new_options_property: Create S7 Options Property

Description

Helper function to create an S7 property with a limited set of valid options.

Usage

new_options_property(
  class = S7::class_any,
  options,
  default = options[[1]],
  name = NULL
)

Value

An S7 property object with validation for allowed options

Arguments

class

The S7 class for the property (default: S7::class_any)

options

Character vector of valid options for the property

default

Default value for the property (default: first option)

name

Optional name for the property

Details

# Create a property that only accepts specific values # color_prop <- new_options_property(options = c("red", "blue", "green"))