My Shiny Dashboard, Milwaukee Beer

March 1, 2019
By

(This article was first published on Posts on Anything Data, and kindly contributed to R-bloggers)







































Milwaukee Beer – Inspired by my Job Hunt


I’m excited to launch my latest Shiny app – “Milwaukee Beer” – which I made to learn shinydashboard. Due to my decision to return to the USA and hunt for a career in data, I decided to add another project to my portfolio. Milwaukee Beer is a metric tracking dashboard that provides quick insights to the unique local brews. You may toggle dropdown tabs to get rankings, nice graphs, and sentiment tracking. Feel free to search for beer by type and flavor too!

App: https://jjohn9000.shinyapps.io/Milwaukee_Beer_App/

Motivation


It’s been a dream of mine to break into the data science field, so prior to my move, I decided to add another project to my portfolio – a sleek Shiny dashboard.

A brutal truth about this project was that I had to invest time in finding my own data and deciding what to do with it. Long story short, I found beeradvocate.org and scraped the Milwaukee-centric subset of it over multiple iterations to build up my dataset. I then combined the information on their local breweries, beers, and ratings/reviews.

Along the way I also discovered highcharter, an amazing library for interactive plots. (If you haven’t heard of it, look it up!) First, let me provide an example of a highcharter plot I used in my dashboard. I hope it will invoke your curiosity and ultimately lure you to my app that helps explore Milwaukee’s rich array of beers!

library(tidyverse)
library(highcharter)
library(readr)

##You can find this data on my github:
## https://github.com/Jjohn987/anything_data/blob/master/public/post/milwaukee_beer3.csv

milwaukee_beer <- read_csv("milwaukee_beer3.csv")[-1] 
   
 milwaukees_favorite <- milwaukee_beer %>%
    select(brewery, beer_name, avg_beer_score,
           beer_style,
           beer_category) %>%
   distinct() %>%
    filter(!is.na(beer_category)) %>%
    group_by(beer_category) %>%
    summarise(total = n(), avg = mean(avg_beer_score)) %>%
    mutate(id = group_indices(., beer_category))
      
 ## Since I want each point colored with custom colors, I need to provide a matching vector of colors.      
 ##Generate pallete
colfunc <-colorRampPalette(c("#E9FF5C", "#FF8800", "#FF2B00"))
hc_colors <- sample(colfunc(nrow(milwaukees_favorite)))

So far, nothing special – just your familiar dplyr chain.
For anybody that hasn’t used the fabulous highcharter package before, add_series is similar to a geom in ggplot2, hcaes are similar to aes, and you can add tooltips, and embed html to an extent.

 highchart() %>%  
      hc_add_series(milwaukees_favorite, type = 'column', hcaes(x = id, y = avg), tooltip = list(pointFormat = "{point.beer_category}: {point.avg}"), showInLegend = F) %>%
      hc_add_series(milwaukees_favorite, type = 'bubble', hcaes(x = id, y = avg, size = total, group = beer_category), tooltip = list(pointFormat = "{point.beer_category}: {point.total}"), marker = list(fillOpacity=1), minSize = 20, maxSize = 80) %>%
      hc_plotOptions(column = list(pointWidth = .5, pointPlacement = "on")) %>%
      hc_title(text = "Milwaukee's Most Common  Brewing Styles",
               useHTML = TRUE) %>%
      hc_yAxis(title = list(text = "Avg Rating", style = list(color = "white", fontSize = 22)), labels = list(style = list(color = "white", fontSize = 15)), tickColor = "white", gridLineColor = "transparent") %>%
      hc_xAxis(labels = list(enabled = F), gridLineColor = "transparent") %>%
      hc_colors(color = hc_colors) %>%
      hc_chart(divBackgroundImage = 'https://i.ibb.co/S0hr0Vd/milwaukee.png',
               borderColor = 'white',
               borderRadius = 10,
               borderWidth = 2,
               backgroundColor = 'transparent') %>%
      hc_legend(backgroundColor = "#0D0D0D99", itemStyle = list(color = "#C9C9C9"), itemHoverStyle = list(color = "yellow"))

Of course, this is a teaser example to lure you to see my dashboard. Go there and explore the unique world of Milwaukee beer (in a marketing style dashboard) already!

End Note

The depth and complexity of the data were not too deep, but demonstrating visualization and tracking were my primary goals. While I’ve previously made a Shiny app that uses Halo 5’s API (yes, the game), dash-boarding has become an important skill which I felt necessary to add to my project list. If anybody in the greater Milwaukee area knows about a job relating to R, SQL, data mining, or viz, please leave me a message or add me on linked in! Contact info is hosted on this site as well as my apps.

To leave a comment for the author, please follow the link and comment on their blog: Posts on Anything Data.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)