We’re back after a long break! In this post, the focus is on using RateBeer API data to analyze patterns in beer volumes by style, and look at the recommended glassware for each style. Our initial analysis will be of the basic statistical variety, using our old friend Exploratory, the powerful R-based software suite.
As is our habit, the process begins with data sourced from the RateBeer API, using the GraphiQL web interface. In this case, the starting point is a simple query that pulls counts by beer style, and contains a subset of recommended glassware for the individual beer style.
This query will return a list of matching records in JSON format, first based on beer style (beerStyles in the above syntax), and then by glassware type (glasses in the above syntax). Here are partial results:
A quick copy & paste to a word editor gives us a JSON file we can use in Exploratory for analysis and visualization purposes.
Here is our initial import into Exploratory:
In the name column we see a sample of the various beer styles – Altbier, Apple Cider, and Belgian Ale, among others. It looks like Exploratory has successfully imported our JSON file, so we can move on to using tables and charts. Here we view a table with all the details for the dataset:
The number of beers for each style is now visible (in the numberOfBeers column), which makes it easy to rank styles by popularity. To do this, we simply move to the charts tab, and select the Bar chart option from the Type dropdown. We’ll sort by the numberOfBeers column, and use a horizontal layout to better display the labels. Here’s our initial result:
One issue at this stage – there are so many styles that we can’t even see all the corresponding labels! One of the great strengths of Exploratory lies in its ability to sort, filter, and display data. We’ll illustrate this by applying a quick filter to limit the dataset. Let’s reduce things by filtering for styles with 5,000 or more individual beers:
Much better! At the top, we see popular stalwarts like IPA and Pale Ale; further down we see some of the Belgian styles such as Flanders Red and Tripel. We have temporarily removed some of the more esoteric styles with fewer examples being brewed, although the data is still available if we remove the filter.
Now let’s look at counts based on a recommended type of glassware. Note that for many beers, there are multiple categories of glassware that are favored for a given style. First, we’ll start with beers where a traditional stein glass is recommended. Note that we have removed the >= 5,000 filter, which will allow us to see all types where a stein is appropriate. The results:
Not surprisingly, many German beer styles rise to the top of the list, including Marzens, Dunkels, and Rauchbiers. In fact, virtually every beer in this group has a German heritage. So if you favor German-style beers, time to get yourself a few steins at the local store!
Let’s apply a new filter, where we change the glassware to the popular tulip style. We might anticipate that German-style beers will not appear on the chart. The results:
No surprise here, as the two most popular styles of all head the list – IPAs and Pale Ales. Saisons and various types of Sours are also well represented in this list. Based on the beers shown on the chart, tulip glasses are a very versatile option to have on your shelf, with the ability to cover a multitude of styles.
Before we close this post, let’s look at two more glassware types, since Exploratory makes filtering super fun & easy! Next up is the lager glass category, where we might logically expect lager beers among other categories.
Interestingly, pale ales remain in the list, while the various styles of IPA have vanished. We also see various types of lager, as well as related styles such as Helles. Plenty of variety here, especially for many styles that tend toward the lower end of the ABV (Alcohol by Volume) scale.
Our final filter will look at English pint glasses, where we might just expect a few beer styles associated with the British Isles, including stouts and porters. Let’s have a look:
We do indeed find stouts, porters, and bitters near the top of the list, but blond & golden ales lead the way. Overall, this is certainly a British-dominated group, with a few surprises (Session IPA, Gose) surfacing.
There are many more things we can do with this dataset, but that’s it for now. One of our next steps will be to get the data in a network graph format, so that we can use Gephi to plot the relationships between beer styles and glassware, and see how they all interconnect. Until then, hope you found this informative, and thanks for reading!