Silver Sparrow Book Review

Silver Sparrow by Tayari Jones is a book that takes place in the 1980’s about two young girls, Dana Lynn Yarbor and Bunny Chaurisse Witherspoon, that are half siblings. They are teenagers close in…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Dashboard application

Analysis of raw data is only half of the job. You have to know how to present all findings, visualize key insights and statistics. There are tons of data visualization tools out there and it is up to you what tool to use. In my case I use R Shiny for interactive dashboards and visualizations. R programming is proven to be one of the best statistical programming languages out there. But did you know about its amazing package called Shiny, which allows you to build interactive web applications as easy as pie?

For demonstration and explanation, I’ve built sample interactive dashboard about Mongolia’s economy and international trade. Since it was done for educational purposes, I didn’t care that much about the validity of data sources. I got it from NSO of Mongolia, World Bank and some other websites.

If you’re new to R programming, you’ll need a lot of packages, but for this article I’ll focus on Shiny.

If you want to try out a demo, there are multiple examples that you can try out.

It’s very convenient when everything is located in the same directory. So the first thing you do is to create a new project. In order to do that:

As Project type you should choose “Shiny Web application”. This will create a sample project in app.R file.

Shiny application consists of user interface and server function. Now, when we start a new Shiny project it is in your best interest to split app.R into different files, such as ui.R, server.R and global.R

But how would you put anything in those panels? You define them in server.R file.

Variable server is a function with input and output as parameters. In this function you declare different outputs. In the example shown below we can observe how output with name “distplot” is rendered as a plot.

This output named “distplot” is then called from ui-side of the application on any panel or box you want by:

Okay, then why do we need global.R? This file is for loading necessary packages, importing data files, cleaning data, defining functions and so on.

In the dashboardSidebar, I placed sidebarMenu, which consists of menuItems. You have to name each tabName.

If you wish to not have a sidebar at all, you can disable it:

Then, in the dashboardBody part, I define in which menu or tab I want the output to be placed. Here, I’m putting H2 header in tab named “global”.

In this area, you can place as many items as you wish. For example, I used valueBox and box to illustrate outputs.

Now, how do we place it in the application? First, in the server-side we define the output named “CountryMap”.

And in the ui-side of the application, we place defined output wherever seems fit.

Data visualization is a vital part of data science. Building complex dashboards and reports that meet business requirements can be challenging and interesting. There are tons of visualization packages that support R Shiny. It’s fully customizable, so your creativity plays a big part here.

Add a comment

Related posts:

The Virtual Data Lake for a Data Scientist

In the previous article we reviewed the architectural elements of the virtual data lake, dug deeper into its technical implications. In this post, we will review the architectural elements of the…