Continued: Black Friday vs. Small Business Saturday:

What Twitter is saying and feeling

Jaclyn Janis

MPH 676, University of Southern Maine, Fall 2018

I decided to try out some of the rTweet package, because I was curious whether some of the functions would be enabled for me with my basic developer account. I did not include the code for my access token (same as with twitteR above), but I used option 2b here.

I searched Black Friday tweets that had a geo location in the U.S. then did the same for Small Business Saturday. Bear in mind that this means that my location data are different from the data used in the analyses above.

bf_geo <- search_tweets(
  "blackfriday", geocode = lookup_coords("usa"), n = 10000)
smbiz_geo <- search_tweets(
  "smallbusinesssaturday", geocode = lookup_coords("usa"), n = 10000)

I used some sample code from the author of the package, Michael Kearney, to handle the geo location data so I could map it in leaflet.

Here is a map of Black Friday and Small Business Saturday tweets. You can explore the text of the tweets on the popups.

library(leaflet)
pal <- colorFactor(c("black", "cyan4"), domain = c("Black Friday", "Small Business Saturday"))
leaflet(geom_day) %>% addProviderTiles(providers$OpenStreetMap, "CartoDB.Positron") %>% addCircles(~lng, ~lat, popup=geom_day$text, weight = 6, radius=100, 
                   color= ~pal(day), stroke = TRUE, fillOpacity = 0.9) %>%
  addLegend("bottomleft", values = ~day, pal = pal, title = "Day")

Discussion

I am not surprised at all to discover the difference in sentiments between Black Friday and Small Business Saturday, as this analysis greatly reflects my own sentiments about these days - more positive for Small Business Saturday, more fear for Black Friday. It was really exciting to analyze Twitter data - I couldn’t help but think of all the applications of mining this treasure trove of information. It was difficult to decide on a topic to analyze.

I’m glad I ventured back into leaflet and tried to map something in a different way. Truth be told, it took me a long time to get everything as I wanted it, and I even had to rerun my Black Friday geo location search because there were very few data points initially, and I’m still unsure why. But I finally executed a successful legend, which I couldn’t seem to do on the last assignment. Huzzah!