Learn R Programming

DescTools (version 0.99.56)

WithOptions: 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)

Value

the function result

Arguments

optlist

a list with new option settings.

expr

the expression to be evaluated

Author

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

See Also

Examples

Run this code
# original:
print((1:10)^-1)

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

Run the code above in your browser using DataLab