Creating a Shiny app with data

lastfm dashboard

I’ve created a dashboard to display the current most popular artists and tracks on lastfm using the Shiny tool developed by RStudio. If you just want to play with the dashboard click here if you want to know more about how I did it please read on

Shiny is a tool developed by RStudio. Its great for creating visual interactive dashboards for your data. You can install the Shiny package from CRAN and use R to develop an App that renders a web page for your dashboard. It has two main components. First, a server script that creates the tables, graphs, and information you want to put in the dashboard. Second a user interface script which defines the layout of the dashboard. I’m not going to teach you how to use it as the peeps at RStudio have this great tutorial you can follow.

Its satisfying once you’ve created your App but you need R on your computer to run it, which means its not sharable beyond R users. RStudio also offers a paid server option to host unlimited Apps and provide access control. Or if you are open about your dashboard a free limited hosting service for the open source community.

The App I’ve created pulls the most popular artists and tracks data from the lastfm API and then displays it in a dashboard. I’ve then hosted the App using The dashboard is pretty basic, but the point is its pulling the latest data available from the API in real time and displaying it for the user. Its a really nice easy way to create realtime BI tool. Here are links to gists of my server script and ui script

Here is the dashboard

Some things I discovered in doing this that might help others:

–Spend a bit of time upfront sketching out how you want the dashboard to look and what parts you want to make interactive.

–The point at which you pull the data in the script is key. This is the slow part so you don’t want the app to have to do this more often than it needs to.

–Make sure you list out all the packages you are using in the server file. The server will make sure these are then installed.

–My first app saved a datafile from the API, however on the server this wasn’t possible so I had to alter my script to pull the data from the API straight into R.

Leave a Reply

Your email address will not be published. Required fields are marked *