option: option

Description Usage Arguments Details Value See Also Examples

View source: R/optional.R

Description

Make a variable optional.

option is an object wrapper which indicates whether the object is valid or not.

Usage

1
option(arg)

Arguments

arg

The variable to make optional

Details

Note that option(option(i)) == option(i) and option(none) == FALSE

Operators and print will have the same behavior with an optional than with its base type.

Value

arg as optional

See Also

none, opt_unwrap(), make_opt()

Examples

1
2
3
4
5
6
7
8
9
a <- option(5)
class(a)
## [1] "optional"

a == 5
## [1] TRUE

a
## [1] 5

optional documentation built on May 1, 2019, 9:14 p.m.