pkg <- c("dplyr", "ggplot2", "readr",
  "knitr", "rmarkdown", "devtools", "DT")

new.pkg <- pkg[!(pkg %in% installed.packages())]

if(length(new.pkg))
  install.packages(new.pkg, repos = "http://cran.rstudio.com")

if(!require(izzyuntappd))
  devtools::install_github("ismayc/izzyuntappd", force = TRUE)

lapply(pkg, library, character.only = TRUE)
options(width = 95, dplyr.print_max = 1e9)

We begin by loading in the dataset from this package.

data(untappd, package = "izzyuntappd")
# I've also included the dataset as a CSV file and you can read it in by using
# untappd <- read_csv(file = "chester_beer_feb15-june16.csv")

One great feature of RStudio is the ability to view dataframes like untappd in table form:

View(untappd)

ABV

Summary values

We can determine what the mean and median abv values are from this data set:

untappd %>% summarize(mean_abv = mean(abv), median_abv = median(abv))

Plotting

We can also create a plot of this distribution of abv:

ggplot(aes(x = abv), data = untappd) +
  geom_histogram(bins = 20, color = "white")

Top styles

If we'd like to see the top number of style of beer I've tried, sorted:

style_count <- untappd %>% count(style)
datatable(style_count)

The datatable function in the DT package provides a nice interface for searching and sorting datasets.

You can now get a sense for which styles of beer I prefer. Think about how you could determine which style of beer I rated highest. Play around with the data more to see which kinds of correlations and things stand out to you!



ismayc/izzyuntappd documentation built on May 18, 2019, 5:51 a.m.