WithOptions: Execute Function with Temporary Options

Description Usage Arguments Value Author(s) See Also Examples

View source: R/DescTools.r

Description

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

Usage

1
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

1
2
3
4
5
# original:
print((1:10)^-1)

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

DescTools documentation built on June 17, 2021, 5:12 p.m.