Get or set Shiny optionsSource:
There are two mechanisms for working with options for Shiny. One is the
options() function, which is part of base R, and the other is the
shinyOptions() function, which is in the Shiny package. The reason for
these two mechanisms is has to do with legacy code and scoping.
options() function sets options globally, for the duration of the R
getOption() function retrieves the value of an option. All
shiny related options of this type are prefixed with
shinyOptions() function sets the value of a shiny option, but unlike
options(), it is not always global in scope; the options may be scoped
globally, to an application, or to a user session in an application,
depending on the context. The
getShinyOption() function retrieves a value
of a shiny option. Currently, the options set via
shinyOptions are for
internal use only.
Name of an option to get.
Value to be returned if the option is not currently set.
Options to set, with the form
name = value.
- shiny.autoreload (defaults to
TRUEwhen a Shiny app is launched, the app directory will be continually monitored for changes to files that have the extensions: r, htm, html, js, css, png, jpg, jpeg, gif. If any changes are detected, all connected Shiny sessions are reloaded. This allows for fast feedback loops when tweaking Shiny UI.
Since monitoring for changes is expensive (we simply poll for last modified times), this feature is intended only for development.
You can customize the file patterns Shiny will monitor by setting the shiny.autoreload.pattern option. For example, to monitor only ui.R:
options(shiny.autoreload.pattern = glob2rx("ui.R"))
The default polling interval is 500 milliseconds. You can change this by setting e.g.
options(shiny.autoreload.interval = 2000)(every two seconds).
- shiny.deprecation.messages (defaults to
This controls whether messages for deprecated functions in Shiny will be printed. See
shinyDeprecated()for more information.
- shiny.error (defaults to
This can be a function which is called when an error occurs. For example,
options(shiny.error=recover)will result a the debugger prompt when an error occurs.
- shiny.fullstacktrace (defaults to
Controls whether "pretty" (
FALSE) or full stack traces (
TRUE) are dumped to the console when errors occur during Shiny app execution. Pretty stack traces attempt to only show user-supplied code, but this pruning can't always be done 100% correctly.
- shiny.host (defaults to
The IP address that Shiny should listen on. See
runApp()for more information.
- shiny.jquery.version (defaults to
The major version of jQuery to use. Currently only values of
1are supported. If
1, then jQuery 1.12.4 is used. If
3, then jQuery 3.6.0 is used.
- shiny.json.digits (defaults to
The number of digits to use when converting numbers to JSON format to send to the client web browser.
- shiny.launch.browser (defaults to
A boolean which controls the default behavior when an app is run. See
runApp()for more information.
- shiny.maxRequestSize (defaults to 5MB)
This is a number which specifies the maximum web request size, which serves as a size limit for file uploads.
- shiny.minified (defaults to
shiny.min.js) or un-minified (
shiny.js) file. The un-minified version is larger, but can be helpful for development and debugging.
- shiny.port (defaults to a random open port)
A port number that Shiny will listen on. See
runApp()for more information.
- shiny.reactlog (defaults to
TRUE, enable logging of reactive events, which can be viewed later with the
reactlogShow()function. This incurs a substantial performance penalty and should not be used in production.
- shiny.sanitize.errors (defaults to
TRUE, then normal errors (i.e. errors not wrapped in
safeError) won't show up in the app; a simple generic error message is printed instead (the error and strack trace printed to the console remain unchanged). If you want to sanitize errors in general, but you DO want a particular error
eto get displayed to the user, then set this option to
stop(safeError(e))for errors you want the user to see.
- shiny.stacktraceoffset (defaults to
TRUE, then Shiny's printed stack traces will display srcrefs one line above their usual location. This is an arguably more intuitive arrangement for casual R users, as the name of a function appears next to the srcref where it is defined, rather than where it is currently being called from.
- shiny.suppressMissingContextError (defaults to
Normally, invoking a reactive outside of a reactive context (or
isolate()) results in an error. If this is
TRUE, don't error in these cases. This should only be used for debugging or demonstrations of reactivity at the console.
- shiny.testmode (defaults to
TRUE, then various features for testing Shiny applications are enabled.
- shiny.trace (defaults to
Print messages sent between the R server and the web browser client to the R console. This is useful for debugging. Possible values are
"send"(only print messages sent to the client),
"recv"(only print messages received by the server),
TRUE(print all messages), or
FALSE(default; don't print any of these messages).
- shiny.autoload.r (defaults to
TRUE, then the R/ of a shiny app will automatically be sourced.
- shiny.usecairo (defaults to
This is used to disable graphical rendering by the Cairo package, if it is installed. See
plotPNG()for more information.
- shiny.devmode (defaults to
Option to enable Shiny Developer Mode. When set, different default
getOption(key)values will be returned. See
devmode()for more details.
There are three levels of scoping for
application, and session.
The global option set is available by default. Any calls to
getShinyOption() outside of an app will access the
global option set.
When a Shiny application is run with
runApp(), the global option set is
duplicated and the new option set is available at the application level. If
options are set from
outside of the server function), then the application-level options will be
Each time a user session is started, the application-level option set is duplicated, for that session. If the options are set from inside the server function, then they will be scoped to the session.
There are a number of global options that affect Shiny's behavior. These
can be set globally with
options() or locally (for a single app) with
A caching object that will be used by
renderCachedPlot(). If not specified, a
cachem::cache_mem()will be used.