• OGC Global

RStudio’s “Shiny” New Feature

How Interactive Data Visualizations Can Provide Competitive Advantages

Rstudio is a fantastic tool for data wrangling, cleaning, analysis and visualization. Along with its standard features for visualization, a great option for presenting data to a client in an interactive way is the Shiny app feature within R.

Shiny is an R package that allows a user to build a web app straight from R code that can be a standalone app or embedded within a website. This feature is very useful because instead of having to create numerous visualizations to send to the client, you can put everything in one place and leave it up to the user to decide what specific visualization they want to see.

A project where I had previously used Shiny was during my capstone project for the Georgia baseball team while working on my masters at the University of Georgia. The team at Georgia had access to a wealth of intriguing data due to a system installed in their stadium called trackman. Trackman is a radar tracking system that records as much data as an analyst could ever dream of, tracking every possible data point about the ball from the moment it leaves the pitcher's hand to the instant the batter makes contact.

This includes information such as spin rate, pitch velocity, location in both the x and y plane, and type of pitch. Our group was tasked with using this data to provide insights to the team about how their players were performing and how we could help the team win more using the data.

While using this data to analyze pitcher or hitter performance would have been a good project, our group decided to focus on something more unique and less studied: catcher behavior. Baseball is a unique game because umpires decide whether a pitch is either a “ball” or a “strike” based on an indeterminate strike zone that is loosely defined as “the volume of space above home plate and between the batter's knees and the midpoint of their torso”. Not only is this strike zone subjective, but so are the umpires' decisions on if a pitch is in this zone. Therefore, the catcher’s behavior can influence the call of the umpire.

If a catcher is graceful and quick enough they can deceive an umpire into thinking a pitch is within the zone when it is not. This art is known as “pitch framing” However, if a catcher is slow and lazy, they can make a pitch in the zone look outside!

A successful pitch frame:

A catcher unintentionally costing his team a strike:

While these extra pitches may not seem like much, they add up over time. In 2019, the leader in pro baseball saved his team approximately 15 runs over the course of an entire season by getting. That can mean the difference between multiple wins and losses, even the difference between a team making the playoffs or failing.

So we used this trackman data to track every pitch (also included in the data was whether the pitch was called a ball or a strike by the umpire) and used R to graph out what the strike zone should be. Each pitch was a point on the graph, a successful frame was colored green, a pitch that was neutral (called correctly by the umpire) was gray, and a lost strike was colored red. We then put every pitcher, catcher, and pitch type as selectable options in our Shiny app. Users could filter by specific catchers and pitchers to find all sorts of interesting data points. Did specific catchers do better with certain pitchers or pitch types? Was one catcher better than the rest? Here is a picture of the interface:

The interface is filtered by a specific pitcher and catcher.

In the end our analysis was quite successful as we found that one of the three catchers on the team saved over 4 runs via pitch framing over the course of a season which averages out to almost one entire win. Using our analysis, the team was able to figure out that one catcher gave them a significant competitive advantage.

Shiny apps are not limited to baseball however, they can be very useful within the consumer insights realm as well. For example, if a client wants to see how various regions of the country or demographics are performing, a Shiny app is a great solution for them to be able to visualize that information in a way that they are in control of and one that is easy to understand. R is a wonderful tool and Shiny is only one of the weapons in the arsenal of an R programmer to show how powerful data can be when utilized correctly!

Jonathan Bell, Data Analyst

#solution #cx #shinyapp #leadership #datavisualization #consumer #baseball #programming #pitchframe #analysis #startup #problemsolving #competitive #ogcglobal

Recent Posts

See All