Dash for R v0.2.0 is a major release which provides nearly complete parity with the Python implementation of the framework.
This version adds an array of new features which improve performance as well as the overall user and developer experience.
Changelog
https://github.com/plotly/dashR/releases/tag/v0.2.0
Highlights
- Support for asynchronous loading and caching of components, faster page rendering
- Hot reloading
- Ability to launch Dash apps directly within RStudio’s viewer pane
- Support for multiple compression methods, including
gzip
,brotli
, anddeflate
- Support for multiple outputs and selective updates using
dashNoUpdate()
- Support for embedding meta tags
- Clientside callbacks written in JavaScript
- More detailed stack traces when debugging, including line numbers
- Updates
dash-renderer
to v1.2.2 -
dashTable
package updated to v4.5.1 -
dashCoreComponents
package updated to v1.6.0, Plotly.js to 1.51.2 -
dashHtmlComponents
package updated to v1.0.2
Previous Releases
In Depth
Hot reloading
# specify dev_tools_hot_reload=TRUE...
app$run_server(host = "127.0.0.1",
port=8050,
debug=TRUE,
dev_tools_hot_reload=TRUE)
# ...and ensure that your Dash for R app is loaded using source():
source("app.R")
Loading apps in RStudio’s viewer pane
# ensure that host is set to 127.0.0.1,
# as required by RStudio for apps loaded
# within the IDE's viewer pane and then
# pass use_viewer=TRUE
app$run_server(host = "127.0.0.1",
port=8050,
debug=TRUE,
use_viewer = TRUE)
Clientside callbacks
// sample clientside.js function within assets folder
if(!window.dash_clientside) {window.dash_clientside = {};}
window.dash_clientside.clientside = {
display: function (value) {
return 'Client says "' + value + '"';
}
}
# which is called from callback via clientsideFunction()
app$callback(
output('output-clientside', 'children'),
params=list(input('input', 'value')),
clientsideFunction(
namespace = 'clientside',
function_name = 'display'
)
)
Multiple outputs
# syntax is quite similar to single-output callbacks
app$callback(output=list(
output(id='text-box', property='children'),
output(id='container', property='style')
),
params=list(
input(id='data-dropdown', property='value'),
input(id='radio-partial', property='value')
Selective updates with dashNoUpdate()
# return dashNoUpdate() in situations where
# the callback should not update any outputs
app$callback(output=list(
output(id='text-box', property='children'),
output(id='container', property='style')
),
params=list(
input(id='data-dropdown', property='value'),
input(id='radio-partial', property='value')
),
function(value, choice) {
if (is.null(value)) {
return(dashNoUpdate())
}
Meta tags
app <- Dash$new(meta_tags = list(list(name = "description", content = "some content")))