How Shiny® and YUNA complement each other
Reading time: approx. 4 min.
In addition to a structured preparation and organization of data and analysis results, flexibility and dynamics are extremely important in the field of data science. In order to gain insights from data, they often have to be explored first. Ideally, the barrier to visualizing and exploring data is relatively low for the data scientist. Data and analysis results should also be presented in an attractive and interactive form for business users and managers, which means the least possible effort for the data scientist. A suitable format is, for example, a Shiny® application that the data scientist can develop independently and without major hurdles. With the new integration widget, this Shiny application can be easily integrated into YUNA dashboards and made available to other users. Thus, the scalability and administrative structure (rights-and-roles concept) of YUNA meets the flexibility and interactivity of Shiny.
Shiny apps for interactive graphics and ad-hoc analyses
Shiny is an R package for the development of web applications. The intuitive development and the large number of configuration and display options allow data to be prepared interactively and parameterizable ad-hoc analyses to be performed. Thus, a Shiny app can be used as a form of result presentation like static graphics, tables or reports.
The advantage: The data scientist can develop the web application in the same language – R – as the analysis itself. This means that the application or display format and the analysis can be completely coordinated by the data scientist. A central aspect of using Shiny apps as a display format for results is the ability to include interactive graphics to explore existing data or analysis results. The aspect of the programming language plays a role here as well. Since the Shiny app is written in R, the data scientist does not have to worry about data models or widget definitions. Another aspect is the possibility to let the user define parameters by different input possibilities (sliders, multiple choice selection, …). For example, they can filter tables or restrict the value range of graphics to filter results or restrict them to special features before exporting them and sharing them with other users. Besides the interactive presentation of results and the parameterization of this presentation, ad-hoc analyses (e.g. time series forecasts) developed with R can also be integrated into Shiny applications. In the same way, data can be restricted in order to calculate a machine learning model based on this data. The results are displayed in the Shiny application right after the calculation and can be evaluated directly. To ensure smooth collaboration, an RStudio Connect or RStudio Shiny Server Pro.
Shiny meets YUNA
On the other hand, YUNA features like the rights-and-roles concept as well as freely configurable and divisible filters can be used within the Shiny app. In addition, the roles assigned in YUNA can be used to control which users can see or use the application or the dashboard built for the application. Furthermore, the role can be passed on to the Shiny application. Depending on the role, only selected data and results can be displayed or certain interactive or ad-hoc analyses can be blocked within the Shiny application.
Shiny meets YUNA
Furthermore, in order to restrict the data basis according to the filter from the beginning or to define certain meta parameters for ad hoc analyses or graphics, it is possible to pass parameters and filters defined in YUNA to the Shiny app. The filter is automatically applied during data retrieval, so that the data corresponding to the filter is available in the Shiny app. For example, the parameters defined in YUNA can be either used as analysis parameters (e.g. time horizon in the forecast of time series data) or to configure graphics (e.g. displaying data for a specific a defined location). The configuration of a Shiny app using YUNA allows the same Shiny application to be integrated into different dashboards with different configuration options and filters.
Integration widget in practice
Let us consider the use case of a sales forecast for different products at different locations:
The data scientist creates a simple baseline model to forecast the sales figures. The data scientist implements this analysis as a Shiny application which displays the historical sales figures and the forecast for a time horizon that can be configured by the user. This Shiny application can be integrated into a YUNA dashboard via the integration widget, where users see the sales figures for their respective locations. The filtering of the data (location, product category etc.) is done automatically depending on the role of the user and is applied in the Shiny app to display only the limited data. The Shiny app can then be used by the user to generate a forecast for a desired time horizon and interactively explore both the historical sales figures and the model-based forecast.
Thus, an analysis integrated in Shiny can be used by different users for different data bases. This offers flexibility and a possibility to present interactively for the end users (e.g. product managers at the respective location). The work of the data scientist consists of the development of an analysis, which he implements in Shiny as a web application and can be easily integrated into YUNA.
The integration of Shiny into YUNA offers many advantages. First, data analysts and data scientists can quickly write their own web applications for their analyses. On the other hand, the results can be released more detailed and in a more user-specific way, since the previously defined filters and parameters can be used from YUNA. At the same time, there is no need to write dedicated Shiny applications for each individual user group because the rights-and-roles concept from YUNA is used. Therefore, analyses and their results can be shared more quickly and used profitably by even more people.
RStudio and Shiny are trademarks of RStudio, PBC
Florian Schmoll - Posted on 04.03.2020
Florian Schmoll hat Mathematik an der Universität Kassel studiert und arbeitet seit 2017 als Data Scientist bei eoda. Seine Hauptaufgaben beinhalten unter anderem die Entwicklung von R-Paketen und die Analyse von Daten im Industriekontext. Die Arbeit als Data Scientist ermöglicht es ihm, sein im Studium erworbenes theoretisches Wissen für die Lösung von Problemen aus der Unternehmenspraxis einzusetzen.