EVOLUTION-MANAGER
Edit File: local_options.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Change global options</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for local_options {rlang}"><tr><td>local_options {rlang}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Change global options</h2> <h3>Description</h3> <ul> <li> <p><code>local_options()</code> changes options for the duration of a stack frame (by default the current one). Options are set back to their old values when the frame returns. </p> </li> <li> <p><code>with_options()</code> changes options while an expression is evaluated. Options are restored when the expression returns. </p> </li> <li> <p><code>push_options()</code> adds or changes options permanently. </p> </li> <li> <p><code>peek_option()</code> and <code>peek_options()</code> return option values. The former returns the option directly while the latter returns a list. </p> </li></ul> <h3>Usage</h3> <pre> local_options(..., .frame = caller_env()) with_options(.expr, ...) push_options(...) peek_options(...) peek_option(name) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>...</code></td> <td> <p>For <code>local_options()</code> and <code>push_options()</code>, named values defining new option values. For <code>peek_options()</code>, strings or character vectors of option names.</p> </td></tr> <tr valign="top"><td><code>.frame</code></td> <td> <p>The environment of a stack frame which defines the scope of the temporary options. When the frame returns, the options are set back to their original values.</p> </td></tr> <tr valign="top"><td><code>.expr</code></td> <td> <p>An expression to evaluate with temporary options.</p> </td></tr> <tr valign="top"><td><code>name</code></td> <td> <p>An option name as string.</p> </td></tr> </table> <h3>Value</h3> <p>For <code>local_options()</code> and <code>push_options()</code>, the old option values. <code>peek_option()</code> returns the current value of an option while the plural <code>peek_options()</code> returns a list of current option values. </p> <h3>Life cycle</h3> <p>These functions are experimental. </p> <h3>Examples</h3> <pre> # Store and retrieve a global option: push_options(my_option = 10) peek_option("my_option") # Change the option temporarily: with_options(my_option = 100, peek_option("my_option")) peek_option("my_option") # The scoped variant is useful within functions: fn <- function() { local_options(my_option = 100) peek_option("my_option") } fn() peek_option("my_option") # The plural peek returns a named list: peek_options("my_option") peek_options("my_option", "digits") </pre> <hr /><div style="text-align: center;">[Package <em>rlang</em> version 1.0.6 <a href="00Index.html">Index</a>]</div> </body></html>