Modern reporting for R with Dash

[This article was first published on R – Modern Data, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Creating an effective, informative, and aesthetically appealing report to showcase your data can be tedious: it’s often difficult to display your data and your plots together in an uncluttered manner, and even harder to implement interactivity between the individual elements. Dash for R facilitates this task, providing an intuitive way to make interactive and customizable reports directly from the R environment, without the need to create your own JavaScript components. If you’re already using R for data wrangling, visualization, and analysis, it’s convenient to stay within the R ecosystem to create your report as well.

Dash for R allows users to present interactive plots and tabular data side-by-side to monitor, highlight, or explore key aspects of their data. The library includes a rich set of GUI components that make it easy to interact with your data out of the box, and allows for customizing all aspects of your dashboard. As a result, it’s surprisingly easy to create a modern report with an intuitive user interface to better communicate your data. 

Displaying and editing your data

Displaying tabular data can give the reader a good sense of the data you are working with, but when it is shown as a static table, it can be hard to digest and intimidating. Instead, it’s nice to display an interactive, formattable spreadsheet, providing a familiar and flexible tool within the report itself. The Dash DataTable component creates tables that can be sorted, filtered, and conditionally formatted, providing extensive support for customized views. 

These tables can also be linked to your plots, so when you modify or filter your data, the changes to your data tables are reflected graphically on the fly. As data are added or modified in the table, the changes are immediately reflected in the linked plot. Data tables that are created or modified in your report can be downloaded locally, so they can be used in another program as well. 

Tabbed applications

With complex analyses, it’s common to end up with more data than can reasonably be displayed at once. It’s better to organize the layout of your app so that the different aspects of your analyses are grouped together. This is where separate tabs and pages are useful. Dash takes the hassle out of creating multi-page apps, allowing you to compartmentalize the data and charts that you display into tabs, using the dccTab component.

For example, if your data has a geographical component, you can display an interactive map in one tab, summary plots in another, and a data table in a third. This allows for an uncluttered display of your data, and separates different views or controls for an easily understandable visualization.

You can also use dccLocation and dccLink to create a multi-page app that can be navigated through links instead of tabs. In fact, our interactive online Dash for R documentation is a multi-page Dash app in itself.

Styling and customization

Whether you have a specific vision for your app or need to incorporate your company’s branding, reports made with Dash are completely customizable. Components can be styled inline with the style property, using local CSS in your app’s assets directory or via an external CSS stylesheet. This means you can quickly modify the look of an individual component directly in R, or reference a CSS file that will apply styles to your components given their className or id. The ability to style an app using an external stylesheet means you can create generalizable styles to be applied to multiple components and have deeper control over the styling of the components, like sliders or radio buttons.  

Interested in learning more?

You can explore full working examples of apps and reports, along with the code to generate them, in the Dash app gallery. Many of these examples show modern takes on traditional dashboards, while others, such as the financial report example pictured below, are structured more like interactive PDFs, allowing researchers and analysts to deliver beautiful and informative reports to their collaborators or clients.

To leave a comment for the author, please follow the link and comment on their blog: R – Modern Data.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)