This report looks at the social media presence of Greater Portland craft brewery tasting rooms on twitter during “Portland Beer Week”.
The 5th Annual Portland Beer Week is a series of events celebrating everything craft beer and run from November 6th - 12th 2016.
Link to the data: brewery_location.xlsx
Note: The link to the data works fine in the knit .html version but does not open in RPubs.
To view the data in RPubs: right-click the link and select “open link in a new tab”.
Load the brewery location data and obtain geocode information.
Create a data frame isolating breweries located in the Greater Portland area.
#Read in Location Name Vector .xlsx
breweryLoc <- read_excel ("brewery_location.xlsx")
#Isolate Greater Portland Breweries
breweryLoc <- breweryLoc %>%
select(name,location,screen_name) %>%
#grep only greater Portland records
filter(grepl('04101|04102|04103|04106|04092', location))
#Obtain Geocode Batch Data
geoBatch <- data.frame(cbind(breweryLoc, geocode(breweryLoc$location)))
#Select the Pertinent Data
brew <- geoBatch %>%
select(name, location, screenName = `screen_name`, lat, lon)
#Convert the screen names to all lower case
brew$screenName <- tolower(brew$screenName)
#Sort by name
brew <- brew %>% arrange(name)
#View the New Table minus the "lat" and "lon" fields
pander((brew %>% select(Name = name, Location = location, `Screen Name` = screenName)),
justify="left",
caption="Greater Portland Craft Breweries")
| Name | Location | Screen Name |
|---|---|---|
| Allagash Brewing Company | 50 Industrial Way, Portland, ME 04103 | @allagashbrewing |
| Austin Street Brewery | 1 Industrial Way, Portland, ME 04103 | @austinstbrewery |
| Bissell Brothers Brewing Company | 4 Thompsons Point, Portland, ME 04102 | @bissellbrosbrew |
| Bunker Brewing Company | 122 Anderson St, Portland, ME 04101 | @bunkerbrewingco |
| Fore River Brewing Co. | 45 Huntress Ave, South Portland, ME 04106 | @foreriverbrew |
| Foundation Brewing Company | 1 Industrial Way, Portland, ME 04103 | @foundationbrew |
| Geary Brewing Company | 38 Evergreen Dr, Portland, ME 04103 | @gearybrewing |
| Lone Pine Brewing | 219 Anderson St, Portland, ME 04101 | @lonepinebeer |
| Mast Landing Brewing Company | 920 Main St, Westbrook, ME 04092 | @mastlanding |
| Oxbow Blending and Bottling | 49 Washington Ave, Portland, ME 04101 | @oxbowportland |
| Rising Tide Brewing Company | 103 Fox St, Portland, ME 04101 | @risingtidebeer |
| Shipyard Brewing Company | 86 Newbury St, Portland, ME 04101 | @shipyardbrewing |
#Set Environment Variable: echo = FALSE
knitr::opts_chunk$set(echo = FALSE, warning=FALSE, message=FALSE, results="hide")
The Twitter authentication code is hidden for security purposes
#Download 1000 Tweets containing the hashtag: #207beerweek
num_tweets <- 1000
beerWeek <- searchTwitter('#207beerweek', n = num_tweets)
#Convert the list of Tweets to a Data Frame
beerWeek_df <- twListToDF(beerWeek)
#Add the "@" symbol to the screenName
beerWeek_df$screenName <- sub("^", "@", beerWeek_df$screenName)
#To preserve the original set of twitter data
#beerWeek_df was exported to a .csv file
##write.csv(beerWeek_df, file = "beerWeek_df.csv",row.names=FALSE)
#while preserving the download code.
#The saved static data is imported here
beerWeek_df <- read_csv("beerWeek_df.csv")
#Set Environment Variable: echo = TRUE
knitr::opts_chunk$set(echo = TRUE, warning=FALSE, message=FALSE)
#Displays the top 10 and the % of Tweeets
percent_df <- beerWeek_df %>%
group_by(screenName) %>%
summarize(n = n()) %>%
mutate(percent = round(100*(n/sum(n)),digits=2)) %>%
arrange(desc(n))
#Added this to dress up the column headers
percent_df <- percent_df %>%
select(`Screen Name` = screenName,
`Number of Tweets Using #207beerweek` = n,
`Percent(%) of Sampled Tweets` = percent)
#View the active users of hashtag #207beerweek
pander(head(percent_df, n=10),
justify=c('left','center','center'),
caption="Top 10 Users of hastag #207beerweek")
| Screen Name | Number of Tweets Using #207beerweek | Percent(%) of Sampled Tweets |
|---|---|---|
| @207beerweek | 100 | 20.58 |
| @TheSquadrito82 | 31 | 6.38 |
| @ActiveBeerGeek | 28 | 5.76 |
| @TheThirstyPig | 20 | 4.12 |
| @beerbabe | 19 | 3.91 |
| @GreatLostBear | 17 | 3.50 |
| @VlandDistribs | 16 | 3.29 |
| @lobsterboy3 | 11 | 2.26 |
| @MastLanding | 10 | 2.06 |
| @cbc_portlandME | 8 | 1.65 |
Looks like a missed opportunity for Most Portland Area breweries
The official sponsor 207beerweek seems to be doing their part by using the hashtag #207beerweek more than any other user.
Breweries in the Greater Portland area did not actively use the hashtag #207beerweek as demonstrated by the above list representing the top 10 screen names tweeting with #207beerweek.
#Create Aggregate Table of ScreenNames
sn_df <- beerWeek_df %>%
select(screenName) %>%
mutate(num_sn = 1) %>%
group_by(screenName) %>%
summarise_each(funs(sum))
#Create a wordcloud
pal1 <- brewer.pal(8,"Dark2")
wordcloud(words = sn_df$screenName,
freq = sn_df$num_sn,
min.freq = 1,
random.order=FALSE,
width=1280,height=800,
scale=c(3,.8),
max.words = 200,
colors=pal1)
Not many Greater Portland Area breweries appear to use hashtag #207beerweek
#Isolate the individual word tweeted
reg <- "([^A-Za-z\\d#@']|'(?![A-Za-z\\d#@]))"
words <- beerWeek_df %>%
filter(!str_detect(text, '^"')) %>%
mutate(text = str_replace_all(text, "https://t.co/[A-Za-z\\d]+|&", "")) %>%
unnest_tokens(word, text, token = "regex", pattern = reg) %>%
filter(!word %in% stop_words$word,
str_detect(word, "[a-z]"))
#Select only words with the "@" sybol
at_df <- words %>% select(screenName = `word`) %>%
filter(grepl("@",screenName)) %>%
mutate(num_at = 1) %>%
group_by(screenName) %>%
summarise_each(funs(sum))
#Create a wordcloud
wordcloud(words = at_df$screenName,
freq = at_df$num_at,
min.freq = 1,
random.order=FALSE,
width=1280,height=800,
scale=c(3,.8),
max.words = 200,
colors=pal1)
A larger number of Greater Portland breweries do appear in the "@mentions" of #207beerweek
Note: Breweries with 0 mentions are not displayed in the table or barchart.
#filter out the NA values to show only breweries with mentions
set.alignment('left')
pander(brew_at_df %>%
select(Name = name, `Screen Name`= screenName, Mentions = num_at) %>%
arrange(Name) %>%
filter(complete.cases(.)),
justify=c('left','left','center'),
caption="Greater Portland Breweries with @ mentions for hashtag #207beerweek"
)
| Name | Screen Name | Mentions |
|---|---|---|
| Allagash Brewing Company | @allagashbrewing | 10 |
| Bissell Brothers Brewing Company | @bissellbrosbrew | 12 |
| Bunker Brewing Company | @bunkerbrewingco | 4 |
| Fore River Brewing Co. | @foreriverbrew | 9 |
| Foundation Brewing Company | @foundationbrew | 9 |
| Geary Brewing Company | @gearybrewing | 1 |
| Lone Pine Brewing | @lonepinebeer | 2 |
| Mast Landing Brewing Company | @mastlanding | 24 |
| Oxbow Blending and Bottling | @oxbowportland | 5 |
| Rising Tide Brewing Company | @risingtidebeer | 22 |
| Shipyard Brewing Company | @shipyardbrewing | 2 |
#filter out the NA values to show only breweries with mentions
ggplot(
(brew_at_df %>%
select(name, screenName, mentions = num_at) %>%
filter(complete.cases(.))),
aes(x=reorder(screenName,mentions), y= mentions)) +
geom_bar(stat="identity", fill="blue") +
xlab("Brewery Screen Name") +
ylab("Mentions") + coord_flip() +
theme_few() + ggtitle("Number of Mentions per Brewery")
A good marketing goal would be to maximize mentions.
Note: Breweries that did not use hashtag #207beerweek are not displayed in the table or barchart.
#filter out the NA values to show only breweries with mentions
set.alignment('left')
pander(brew_sn_df %>%
select(Name = name, `Screen Name` = screenName, `Hashtag Usage` = num_sn) %>%
arrange(`Name`) %>%
filter(complete.cases(.)),
justify=c('left','left','center'),
caption="Greater Portland Breweries with @ mentions for hashtag #207beerweek.")
| Name | Screen Name | Hashtag Usage |
|---|---|---|
| Bunker Brewing Company | @bunkerbrewingco | 1 |
| Geary Brewing Company | @gearybrewing | 1 |
| Rising Tide Brewing Company | @risingtidebeer | 3 |
Note: At the start of this project there were 3 records in the table.
The volume of tweets is dependant on the most recent cached Twitter data and the folling bar chart is not very interesting with only two objects.
#filter out the NA values to show only breweries with mentions
ggplot((brew_sn_df %>%
select(name, screenName, Hashtag_Usage = num_sn) %>%
arrange(desc(screenName)) %>%
filter(complete.cases(.))),
aes(x=reorder(screenName,Hashtag_Usage), y=Hashtag_Usage)) +
geom_bar(stat="identity", fill="blue") +
xlab("Brewery Screen Name") +
ylab("Number of Times #207beerweek was Used") + coord_flip() +
theme_few() + ggtitle("Usage of Hashtag #207beerweek per Brewery")
Not many of the Greater Portland Breweries used the hashtag #207beerweek
The social media presense of Greater Portland craft brewery tasting rooms on twitter during “Portland Beer Week” represents a missed opportunity.
Maximizing usage of the hashtag #207beerweek during Portland Beer Week would likely increase their Mentions.
By simply tweeting their respective marketing material with the hashtag #207beerweek a few times a day, breweries could spread better awareness of their products.
If you are interested in visiting any of the Greater Portland craft brewery tasting rooms, you can locate them on the map below.
#Create popup meta data
brew_popup <- paste("<strong>Name: </strong>",ptld_df$name,
"<br><strong>Address:</strong>",ptld_df$location,
"<br><strong>Twitter Handle: </strong>",ptld_df$screenName,
"<br><strong>Number of Mentions: </strong>",ptld_df$num_at,
"<br><strong>Hashtag Usage: </strong>",ptld_df$num_sn)
#Create a Map and Insert Markers from ptld_df
leaflet(data = ptld_df) %>% addTiles() %>%
setView(lng = -70.303, lat = 43.68, zoom = 12) %>%
#Insert Third Party Tiles
addProviderTiles("Esri.DeLorme") %>%
#Add Markers and Pop-up Data
addMarkers(~lon, ~lat, popup = ~brew_popup)
Thank Your for Your Time