WithOptions: Execute Function with Temporary Options

View source: R/DescTools.r

WithOptionsR Documentation

Execute Function with Temporary Options

Description

Setting and resetting options is lengthy in command mode. WithOptions() allows to evaluate a function with temporary set options.

Usage

WithOptions(optlist, expr)

Arguments

optlist

a list with new option settings.

expr

the expression to be evaluated

Value

the function result

Author(s)

Thomas Lumley <t.lumley@auckland.ac.nz>

See Also

options, getOption

Examples

# original:
print((1:10)^-1)

# with new options
WithOptions(list(digits=3), print((1:10)^-1))

DescTools documentation built on Sept. 26, 2024, 1:07 a.m.