Category Archives: TidyX Screen Cast

TidyX 28: Shiny Apps Part 3 – K-Nearest Neighbor and Reactivity

In installment three of our {shiny} dashboard from scratch series, Ellis Hughes and discuss how to use the K-Nearest Neighbor algorithm to forecast a player’s career projection for the Value Over Replacement Player (VORP) metric.

We then take this analysis and build upon our {shiny} app from the previous two weeks by walking through how to add statistical analysis to the server. This will allow you to add your analytics models to your {shiny} app so that the model runs under the hood while the user sees the output. We also go over reactivity and add an action button to give the user more control of the output they see.

The finished result is a {shiny} app with three tabs:

  1. Tab 1 shows the player stats over the past 3 years and where they rank compared to other players.
  2. Tab 2 allows the user to compare players in VORP by selecting the players they are interested in.
  3. Tab 3 uses K-Nearest Neighbor to forecast the rest of the player’s career by identifying the players that are most similar to in regards to how they have performed over time.

To watch the screen cast, CLICK HERE.

To access our code, CLICK HERE.

To see the previous parts of our {shiny} app development series:

Part 0.5
Part 1

Part 2

TidyX 27: Shiny Apps Part 2 – Adding Tabs and Improving UI

Ellis Hughes and I start by discussing a really cool script for developing line plots by Leon Eyrich Jessen. Leon created these plots for analyzing data from the TidyTuesday Project on the famous television show Friends.

We then continue our discussion of {shiny} web apps by showing you how to add tab panels so that you can have different pages of information within the same app and improve the user interface experience.

We extend our app from last week by adding a tab panel consisting of line plots for evaluating career comparisons between players in the Value Over Replacement Player (VORP) statistic.

To watch the screen cast, CLICK HERE.

To access our code, CLICK HERE.

TidyX 26: Shiny Apps Part 1 – Creating an NBA Dashboard

Building off our screen cast from last week, where we discussed the basics of reactivity in a {shiny} app, Ellis Hughes and I expand on the concept and begin constructing the pieces of our NBA dashboard. For inspiration purposes, we are building elements similar to Five Thirty Eight’s CARMELO NBA Player Projection webpage.

We start by creating the table and percentile charts in an interactive web app:

But before we get into that, we break down the code of @MrOchiwar, who made some really nice line plots of Nigerian crop yields over time, using data provided by the TidyTuesday project.

To watch the screen cast, CLICK HERE.

To access our code, CLICK HERE.


TidyX 25: Intro to Shiny Apps

This week, Ellis Hughes and I begin a series on building Shiny apps. We’ve built several Shiny apps in the past (for example TidyX 3 or TidyX 24) but always feel rushed to explain some of the fundamental coding that is necessary for people to get off the ground. As such, and because the syntax for Shiny apps can be a little funky, we decided to create a series where we of episodes on Shiny apps where we will take a data set and iteratively build a Shiny app from scratch.

In this week’s episode we help get you off the ground with your first Shiny app by walking you through my very own starter template. When I sit down to develop a Shiny app (which is pretty much weekly at this point) I always start with this exact template just to help me get going and get the data showing up in a webpage. From there I begin to customize the app based on need.

To watch the screen cast, CLICK HERE.

For our code, CLICK HERE.

TidyX 24: Waffle Plots, Shiny Apps, and Wide Receiver Target Shares

This week, Ellis Hughes and I break down code that Jared Braggins wrote to construct waffle plots describing plant extinction in Africa using data from TidyTuesday.

For those that are unfamiliar, a waffle plot is a great way for showing counts of data and the relative contribution of one value to a group. This type of plot lends itself well to the number of targets each receiver on an NFL team receives relative to other receivers on that team. So, we took Jared’s idea, used the {waffle} package, and constructed our own waffle plot. We then extended this out into an interactive {shiny} app so that the user can select a team of interest and get returned back a waffle plot for that team along with a team of data providing the receiver statistics for that given season. Finally, we provide the option to download the output as a PDF report directly from the {shiny} app. When it is all done, it looks a little something like this:

To watch the screen cast, CLICK HERE.

To obtain our code, CLICK HERE.