knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>")
library(beeR)
library(ggplot2)

Introduction

Brewers and beer enthusiasts are always on the hunt for something new in the world of beer that they haven't had before, whether this is a new example of their favorite style, a style they've never tried, or a style possibly no one has ever tried. BreweryDB is a crowd-sourced and community-curated database of beer knowledge. The goal of BreweryDB is:

To make the best, most comprehensive collection of data surrounding the beer and brewing community, then make that data available for free to developers all over the world.

The goal of this package is to facilitate access to this data via R and to provide tools for exploration and visualization of this data making use of the rich set of R tools for this.

Getting style data

Before getting any data you will need an API key. Sign up for an account and request a key at brewerydb.com/developers.

Once you have a key, create an object containing this string.

key <- "replace this with your key"

Now you can use the several find_ functions in the beeR package to request BreweryDB data. For example you can get all of the BJCP style guidelines data.

styles <- find_styles(api_key = key, style_name = "")
head(styles)
names(styles)

You can then plot out this data.

ggplot(data = subset(styles, !is.na(styles$ibuMin)), mapping = aes(x = as.numeric(ogMin), 
                                 y = as.integer(ibuMin), 
                                 color = category.name)) + 
  geom_point(mapping = aes(label = id), position = position_jitter()) + 
  scale_color_brewer(type = "qual", palette = 3) + labs(x = "Minimum OG", y = "Minimum IBU", color = "Style Category") + theme_classic() + theme(axis.text.x = element_text(angle = 90))

Before going much further let's clean up this data a bit

names(styles)
styles[,6:14] <- apply(styles[,6:14], MARGIN = 2, FUN = "as.numeric")


warlicks/beeR documentation built on May 28, 2019, 7:53 a.m.