The world’s leading publication for data science, AI, and ML professionals.

PowerBI vs. R Shiny: Two Popular Excel Alternatives Compared

How does R Shiny compare to drag and drop visualization tools like PowerBI?

Photo by Carlos Muza on Unsplash
Photo by Carlos Muza on Unsplash

Choosing the appropriate dashboarding/reporting/BI tool has never harder than it is now, as there are plenty of genuinely great options such as R Shiny, PowerBI, and Tableau. Today we’ll compare two widely used tools at Fortune 500 companies:

  • PowerBI – a collection of software services, apps, and connectors that work together to turn unrelated sources into coherent, visually immersive, and interactive insights (source: Microsoft)
  • R Shiny – a web framework written in R, widely used to make dashboards and interactive web applications

One thing to keep in mind: R Shiny is not a reporting/dashboarding tool. Rather, it is a full web framework. As most people use it to make dashboards, and many of our customers compare R Shiny with PowerBI when they invest in analytical solutions, we can consider this comparison fair. We’ll start with a basic overview of PowerBI and then compare both tools in various areas, such as:

  • Connectivity
  • Chart Types
  • Ease of Use: Simple Charts
  • Ease of Use: Simple Dashboards
  • User Input and Interactivity
  • Visual styling
  • Conclusion

PowerBI Overview

As mentioned previously, PowerBI is used to represent interactive insights from various data sources visually. It is a perfect tool for reporting, which is a read-only operation and is relatively easy to build and maintain.

PowerBI is also one of the easiest tools to get started with, as only a couple of crash courses should get you up to speed in no time. We’re not saying R is difficult to learn, but the drag and drop GUI interface is considered to be easier to learn than R, at least for business folks.

But here’s one of the most important selling points – PowerBI just looks good out of the box. You don’t have to be an expert to produce great-looking visualizations with PowerBI. Shiny requires much more manual labor to produce great-looking dashboards. Manual work isn’t necessarily bad, as there’s no limit to what you can do if you’re willing to put the effort in, but simple drag and drop tools are more than enough most of the time.

For every pro, there’s a con, and PowerBI is not an exception. One of the most significant disadvantages of PowerBI is that it is read-only. As a user, you cannot use charts/tables to make decisions and save them in a database directly.

Also, PowerBI doesn’t have an accessible source code.You can only edit fields in WYSIWYG mode, which makes PowerBI easy to start but difficult to maintain. Having no source code makes it nearly impossible to have proper version control, automatically test logic, or collaborate on large projects.

PowerBI comes in a few different flavors, listed below:

  • PowerBI Desktop – an application you can download and install on your computer. Available only for Windows. It has powerful data analysis capabilities and can connect to many data sources. It is used to perform analysis, create visualizations, and to create reports.
  • PowerBI Service (Pro) – web application. It is used to create visualizations and reports. The biggest selling point is dashboards -and they are easy to make. Also, it’s easier to share results thanks to the collaboration mode.
  • PowerBI Mobile – mobile application for both Android and iOS. It is used only to access your data from anywhere, not to perform analysis.

Most of our attention today will focus on the PowerBI Desktop variant.


Connectivity

PowerBI comes with many built-in connection types categorized into Files, Databases, Power Platform, Azure, and Online services, and is, without any doubt, more versatile than our last contestant – Tableau. As of late 2020, you find these connection options:

Image by author
Image by author

Put simply, PowerBI doesn’t come short when it comes to connectivity. On the other side of the equation, R Shiny uses R as the programming language of choice, so Shiny can connect to any source that R can.

A simple Google search will yield either a premade library or an example of API calls for any data source type. R Shiny can sometimes have an edge for domain-specific sources. Still, we’ve found multiple examples of PowerBI handling domain-specific data sources, such as CAD files.

Winner (Connectivity): Tie


Chart Types

PowerBI provides basic visualization options – bar, line, area, scatter, and pie charts, with a couple of fancier types such as maps, treemaps, funnels, and ribbon charts. Refer to the image below for a full list:

Image by author
Image by author

Still, it might be more than enough for most use cases, as more sophisticated statistical plots don’t appear too often in production dashboards. Also, you might have noticed these "R" and "Py" icons. This means you can use R and Python charts in PowerBI, with just one caveat – the source code of these charts is not under version control.

In R Shiny, you can use any visualization library that’s available in R, such as ggplot2 and plotly. Here’s an overview of the types of visualizations you can do with both:

GGplot2 options; Source: https://www.r-graph-gallery.com
GGplot2 options; Source: https://www.r-graph-gallery.com
Plotly options; Source: https://plotly.com/r/
Plotly options; Source: https://plotly.com/r/

Declaring a winner in this department is a no-brainer. Sure, Shiny can do a lot, but PowerBI can do all of that and much more. PowerBI can handle its own charts and Python-generated ones.

Winner (Chart Types): PowerBI


Ease of Use: Simple Charts

We’ll now get our hands dirty with recreating the same visualization in both PowerBI and Shiny. For demonstration purposes, we’ll use the Gapminder dataset, so make sure to download it if you’re following along. The goal is to create a simple line chart, comparing average life expectancy over time per continent.

Let’s start with PowerBI. We’ve imported the dataset and created the visualization with the following steps:

Image by author
Image by author

PowerBI was designed to be easy to use for people from all backgrounds, making this simple chart a no-brainer to implement.

Replicating the same in R Shiny is quite a different story, as we need to write actual code. The dataset is available in R through the gapminder package, so there’s no need to download and import the provided CSV. Shiny introduces some boilerplate code – an apparent downside for this simple chart but negligible for larger, real-world projects.

Here’s the code:

And here are the results:

Image by author
Image by author

To conclude, there’s no point in using R Shiny to produce single-chart and non-interactive dashboards. This is one of the areas where PowerBI dominates, as it’s easy and intuitive to use. Also, charts in R require a bit of customization to look decent and interpretable, which comes out of the box with PowerBI.

Winner (Simple Charts): PowerBI


Ease of Use: Simple Dashboards

Making a simple dashboard in PowerBI was easy – a couple of clicks here and there, a couple of filters, and we’re ready to go. The goal was to display three charts:

  • Average life expectancy through time – as a line chart
  • Total population per continent – only in the most recent year (2007), represented as a bar chart
  • Life expectancy vs. GDP per capita – simple scatter plot, colored by continent

The entire dashboard can then be filtered by continent – by selecting a single one or multiple. Here’s what we’ve managed to create in PowerBI:

Image by author
Image by author

To implement roughly the same dashboard in R Shiny, we need to write some R code. Once again, R is a relatively easy language to learn, so we don’t see it as a problem for more tech-savvy users.

The following code recreates the dashboard we had in PowerBI:

And here’s what the dashboard looks like:

Image by author
Image by author

We’ll work on visual appearance later, so don’t worry too much about that. It’s hard to announce a clear winner here, but R Shiny’s dashboard feels more solid to work in.

As we saw, you can make a simple dashboard much faster with PowerBI. For this reason, we’ll declare PowerBI the winner for simple dashboards, but only for ease of use. R Shiny is more versatile if you require a sophisticated dashboard.

Winner (Simple Dashboards): PowerBI by a nose


User Input and Interactivity

As mentioned in the overview section, PowerBI is read-only. Sure, you can click on the various filters to include/exclude some data from the chart, but that’s pretty much all you can do. We think inputs are essential in creating interactive dashboards, so a full web framework like Shiny annihilates its opponent in this department.

Shiny has a wide array of inputs – from text fields and buttons to dropdowns and modals. Here’s everything Shiny provides:

Image by author
Image by author

With all of these options, if arranged right, there’s no task too difficult for Shiny to solve. If you still aren’t sold on the importance of interactivity, here are a couple of points that will make you reconsider:

  • The file input component allows us to upload a custom dataset and perform exploration in the browser
  • The text input and password input fields allow us to build complete web forms – think authentication
  • The var select input allows us to quickly select column(s) of interest from a dataset

Winner (User Input and Interactivity): R Shiny


Visual Styling

Tweaking the looks and feels of visuals in drag and drop tools like PowerBI or even Tableau was never their strong point. These tools are designed to look good by default. Still, not everyone agrees on what classifies as good, so it’s nice to have options.

We’ve found that you can tweak a decent amount of things in PowerBI. Here’s a rough overview:

Image by author
Image by author

The story is quite different with R Shiny. You can embed custom CSS styles by creating awww folder right where your Shiny app is. The CSS files are then stored inside the mentioned folder.

To connect the two, you have to put theme = main.css inside the fluidPage in the Shiny app. That’s all. In just a couple of minutes with CSS, we’ve managed to transform our dashboard quite a bit:

Image by author
Image by author

Here’s the source code for the completed dashboard. The winner of this battle is obvious, once again. PowerBI looks good out of the box, sure, but there’s not much you can do to make it look perfect. R Shiny is extremely versatile when it comes to visual styling (in the hands of the right developer).

Winner (Visual Styling): R Shiny


Conclusion

The final results are in:

  • PowerBI – 3 points
  • R Shiny – 2 points
  • Tie – 1 point

By our count, PowerBI took the lead by a single point for most general use-cases. Of course, choosing the appropriate tool isn’t as simple as counting to 5, so some further clarifications are required. PowerBI is great when you need something relatively simple and aren’t worried too much about the looks and overall feel of the dashboard.

For anything more complex, R Shiny overthrows PowerBI. PowerBI just can’t compare with the customizability that Shiny offers, especially if you need to create an enterprise application.


Loved the article? Become a Medium member to continue learning without limits. I’ll receive a portion of your membership fee if you use the following link, with no extra cost to you.

Join Medium with my referral link – Dario Radečić


Originally published at https://appsilon.com on October 29, 2020.


Related Articles