get_option: get_option - lazy, drop-in replacement for getOption

Description Usage Arguments Details Value See Also Examples

View source: R/get_option.R

Description

get_option allows for deep-inspection of Global Options. The problem with base::getOption is that retrieves options by name only. This make is difficult to work with deeply layered options and promotes package developers to create top-level global options like data.table.xxx rather than using data.table$xxx

base::getOption

Usage

1
get_option(x, default = NULL)

Arguments

x

character or unquoted expression for retrieving the option

default

if the specified option is not set in the options list, this value is returned. This facilitates retrieving an option and checking whether it is set and setting it separately if not.

Details

Lazy, drop-in replacement for base::getOption that allows for deep retrieval rather than access by name alone

Value

The current value for option x or NULL if unset.

See Also

getOption
set_option

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
set_option( foo = list( bar="baz" ) )

   get_option('foo')
   get_option(foo)             # same, unquoted

   # DEEP RETRIEVAL
   get_option(foo$bar)         # "baz"
   get_option( foo[['bar']] )  # "baz"

   set_option( lets = letters[1:5] )
   get_option( lets[1:5] )

   # USES DEFAULT
   get_option(xdx$ydy, default="default")  # does not exist, e.g.

decisionpatterns/options documentation built on May 12, 2017, 9:56 p.m.