Kendrick & Future

#devtools::install_github("lchiffon/wordcloud2")
library(genius)
library(tidyverse)
## ── Attaching packages ──────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.2.1     ✓ purrr   0.3.3
## ✓ tibble  2.1.3     ✓ dplyr   0.8.5
## ✓ tidyr   1.0.2     ✓ stringr 1.4.0
## ✓ readr   1.3.1     ✓ forcats 0.4.0
## ── Conflicts ─────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(wordcloud2)
library(tidytext)

Kencrick Lamar’s “DAMN” and Future’s “FUTURE”

For my project I have decided to compare two popular rappers with very different subject matter to see which words they have most in common. On one end i wanted to use a consious rapper who’s subject matter usually includes black empowerment, building our communities and police brutality. On the other end i decided to use a rapper who raps about money, women and drugs. The two rappers are Kendrick Lamar and Future. I chose the albums “DAMN” and “FUTURE” because these two albums were released in the same year(2017). I expect the most popular words between the two to be curse words with the most popular word most likely being the “N word”

WordCLoud Kendrick

First was the word cloud for Kendrick Lamar’s “DAMN”

library(genius)
library(tidyverse)
library(wordcloud2)
library(tidytext)
ken <- genius_album(artist = "Kendrick Lamar", album = "DAMN")
## Joining, by = c("track_title", "track_n", "track_url")
ken %>% 
  unnest_tokens(word, lyric) %>% 
  anti_join(stop_words) %>% 
  count(word, sort = TRUE) -> kenCount
## Joining, by = "word"
wordcloud2(kenCount)

Sentiment Analysis

Next i did a sentiment analysis for the positive and negative words used most on Kendrick Lamar’s “DAMN” album

ken %>% 
  unnest_tokens(word, lyric) %>% 
  anti_join(stop_words) %>% 
  inner_join(get_sentiments("bing")) %>% 
  count(word, sentiment, sort = TRUE) %>% 
  arrange(desc(n)) %>% 
  head(10) %>% 
  ggplot(aes(reorder(word, n), n)) + geom_col() + coord_flip()+ facet_wrap(~sentiment, scales = "free_y")
## Joining, by = "word"
## Joining, by = "word"

WordCloud Future

Next i did the wordcloud for my opposing rapper, Future and his album “FUTURE”

library(genius)
library(tidyverse)
library(wordcloud2)
library(tidytext)
fut <- genius_album(artist = "Future", album = "FUTURE")
## Joining, by = c("track_title", "track_n", "track_url")
fut %>% 
  unnest_tokens(word, lyric) %>% 
  anti_join(stop_words) %>% 
  count(word, sort = TRUE) %>%
head(50) -> futLimit
## Joining, by = "word"
wordcloud2(futLimit)

Future’s Sentiment Analysis

fut %>% 
  unnest_tokens(word, lyric) %>% 
  anti_join(stop_words) %>% 
  inner_join(get_sentiments("bing")) %>% 
  count(word, sentiment, sort = TRUE) %>% 
  arrange(desc(n)) %>% 
  head(10) %>% 
  ggplot(aes(reorder(word, n), n)) + geom_col() + coord_flip()+ facet_wrap(~sentiment, scales = "free_y")
## Joining, by = "word"
## Joining, by = "word"

RBind between Future and Kendrick

futs <- genius_album(artist = "Future", album = "FUTURE")
## Joining, by = c("track_title", "track_n", "track_url")
kens <- genius_album(artist = "Kendrick Lamar", album = "DAMN")
## Joining, by = c("track_title", "track_n", "track_url")
rbind(futs,kens) -> futKen
futKen %>% 
  unnest_tokens(word, lyric) %>% 
  anti_join(stop_words) %>% 
  count(word, sort = TRUE) %>% 
  head(50) -> futKenOutput
## Joining, by = "word"
wordcloud2(futKenOutput)

After cross refrencing the two albums using RBind i was able to see the most used words between the two artist

RBind Sentiment Analysis

futKen %>% 
  unnest_tokens(word, lyric) %>% 
  anti_join(stop_words) %>% 
  inner_join(get_sentiments("bing")) %>% 
  count(word, sentiment, sort = TRUE) %>% 
  arrange(desc(n)) %>% 
  head(10) %>% 
  ggplot(aes(reorder(word, n), n)) + geom_col() + coord_flip()+ facet_wrap(~sentiment, scales = "free_y")
## Joining, by = "word"
## Joining, by = "word"

These are the final results between the two, as you can see most of the words the two rappers have in common are curse words with the most popular word being “Bitch”. I was expecting the most popular words to be curse words but I didnt expect a rapper like Kendrick Lamar to use a derogatory word against women as much as he did.