# Welcome to the BrewStat repository This repository includes the codes and data for statistical analysis of Brewdog brewery beer recipes and their ratebeer ratings. # Getting started The *data/brewstat.csv* is a comma separated file where each row describes the recipe and the ratebeer.com rating for a single BrewDog beer. The data can be read into R as follows: ``` brewstat <- read.table("data/brewstat.csv", sep = ",") dim(brewstat) # [1] 109 379 ``` # The data The brewstat data is a combination of [BrewDog's recipe api](https://github.com/samjbmason/punkapi-db) and [ratebeer.com's BrewDog ratings page](https://www.ratebeer.com/Ratings/Beer/ShowBrewerBeers.asp?BrewerID=8534). ## Features The brewstat data includes the following features: - Beer name, id, description etc - End product stats: abv, ibu, target_fg, target_og, ebc, srm, ph, attentuation, volume - Brewer's tips and food pairings - 238 columns describing the **hops** in the beer. The Hop columns are named as *"Hop".name.attribute.add*. The *attributes* are one of "bitter", "flavour", "aroma", "twist". *Add* is one of "start", "middle", "end", "dry hop". The value of each column is the amount of the hop used (in the way as described by it's attributes) in the beer. A single hop can be used in multiple ways in one beer. The value of a "Hop.*"" column is zero if the name-attribute combination is not used in the beer. - 90 columns describing the **malts** in the beer. Each column gives the name of the malt in a format: *"Malt".name*. The value of each column is the amount of malt used in the beer. The value is zero if the malt was not used in the beer. - 14 columns describing the **methods**: mash temperatures and units and a few columns describing fermentations temperatures. - The data also includes the following columns retrived from ratebeer.com and are named as "ratebeer_*": ABV, Added (date), Score, Style, rank, beer_type ## Recipe data The Brewdog recipe data is retrieved from [samjbmason/punkapi GitHub repository](https://github.com/samjbmason/punkapi-db), where it lives in JSON format. The recipe data can be thought to consist of 4 elements (methods, malts, hops, info). In addition to fetching and processing the raw JSON data, the *data/punk_recipes_create.R* script shows how to combine the 4 parts of the recipe data into a table where each row descripes the features for a recipe of a single Brewdog beer. ``` recipes <- read.table("data/punk_recipes.csv", sep = ",") dim(recipes) # [1] 234 371 ``` ## Rating data The rating data is retrieved from [ratebeer.com's BrewDog beer list](https://www.ratebeer.com/Ratings/Beer/ShowBrewerBeers.asp?BrewerID=8534) on 9.3.2017. It includes a few descriptive stats and the ratebeer rating and ranking for the BrewDog beers. The *data/punk_ratings_create.R* script shows how to scrape the data from a web page using R. ``` ratings <- read.table("data/punk_ratings.csv", sep = ",") dim(ratings) # [1] 337 7 ```