Getter and setter functions
Usage
# S3 method for class 'GlobalOptionsFun'
x[nm]
dump_opt(x, nm)
# S3 method for class 'GlobalOptionsFun'
x[[nm]]
# S3 method for class 'GlobalOptionsFun'
x[[nm]] <- value
# S3 method for class 'GlobalOptionsFun'
names(x)
# S3 method for class 'GlobalOptionsFun'
.DollarNames(x, pattern = "")
# S3 method for class 'GlobalOptionsFun'
x$nm
# S3 method for class 'GlobalOptionsFun'
x$nm <- valueArguments
- x
The option object returned by
set_opt()orsetGlobalOptions().- nm
A single option name.
- value
The value which is assigned to the option.
- pattern
Ignore.
Details
[ (single bracket) returns a single option object.
dump_opt() is identical to [.
[[ (double brackets) returns the value of the option.
The .DollarNames method makes the option object looks like a list that it allows option name completion after $ (by double clicking the "enter/return" key).
Examples
opt = set_opt(a = 1, b = "b")
opt["a"]
#> Field Value
#> name a
#> default_value 1
#> current_value 1
#> length no limit
#> class no limit
#> validate a user-defined function
#> failed_msg Your option is invalid.
#> filter a user-defined function
#> read.only FALSE
#> private FALSE
#> visible TRUE
#> description ""
#> __generated_namespace__ R_GlobalEnv
opt["b"]
#> Field Value
#> name b
#> default_value b
#> current_value b
#> length no limit
#> class no limit
#> validate a user-defined function
#> failed_msg Your option is invalid.
#> filter a user-defined function
#> read.only FALSE
#> private FALSE
#> visible TRUE
#> description ""
#> __generated_namespace__ R_GlobalEnv
dump_opt(opt, "a")
#> Field Value
#> name a
#> default_value 1
#> current_value 1
#> length no limit
#> class no limit
#> validate a user-defined function
#> failed_msg Your option is invalid.
#> filter a user-defined function
#> read.only FALSE
#> private FALSE
#> visible TRUE
#> description ""
#> __generated_namespace__ R_GlobalEnv
dump_opt(opt, "b")
#> Field Value
#> name b
#> default_value b
#> current_value b
#> length no limit
#> class no limit
#> validate a user-defined function
#> failed_msg Your option is invalid.
#> filter a user-defined function
#> read.only FALSE
#> private FALSE
#> visible TRUE
#> description ""
#> __generated_namespace__ R_GlobalEnv
opt[["a"]]
#> [1] 1
opt[["b"]]
#> [1] "b"
opt[["a"]] = 200
opt[["a"]]
#> [1] 200
names(opt)
#> [1] "a" "b"
opt$a
#> [1] 200
opt$a = 100
opt$a
#> [1] 100