Description Usage Arguments Value See Also Examples
Temporarily change global options.
1 2 3  with_options(new, code)
local_options(.new = list(), ..., .local_envir = parent.frame())

new, .new 

code 

... 
Additional options and their values 
.local_envir 

[any]
The results of the evaluation of the code
argument.
withr
for examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25  # number of significant digits to print
getOption("digits")
# modify temporarily the number of significant digits to print
with_options(list(digits = 3), getOption("digits"))
with_options(list(digits = 3), print(pi))
# modify temporarily the character to be used as the decimal point
getOption("digits")
with_options(list(OutDec = ","), print(pi))
# modify temporarily multiple options
with_options(list(OutDec = ",", digits = 3), print(pi))
# modify, within the scope of the function, the number of
# significant digits to print
print_3_digits < function(x) {
# assign 3 to the option "digits" for the rest of this function
# after the function exits, the option will return to its previous
# value
local_options(list(digits = 3))
print(x)
}
print_3_digits(pi) # returns 3.14
print(pi) # returns 3.141593

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.