powered by
Make a variable optional.
option is an object wrapper which indicates whether the object is valid or not.
option
option(arg)
The variable to make optional
arg as optional
arg
optional
Note that option(option(i)) == option(i) and option(none) == FALSE
option(option(i)) == option(i)
option(none) == FALSE
Operators and print will have the same behavior with an optional than with its base type.
none, opt_unwrap(), make_opt()
# NOT RUN { a <- option(5) class(a) ## [1] "optional" a == 5 ## [1] TRUE a ## [1] 5 # }
Run the code above in your browser using DataLab