Learn R Programming

DescTools (version 0.99.37)

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)

Arguments

optlist

a list with new option settings.

expr

the expression to be evaluated

Value

the function result

See Also

options, getOption

Examples

Run this code
# NOT RUN {
# 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