This project will be looking at the most common words in One Direction’s 5 albums and comparing them to the most common words in each of the band member’s solo albums to see if there is any overlap. One Direction was a band formed in London in 2010 during the X Factor. The band’s members were Harry Styles, Niall Horan, Liam Payne, Louis Tomlinson, and Zayn Malik, who left the band in March 2015 before recording One Direction’s fifth album. Each of the members of the band are now doing solo careers and have recorded one to three albums on their own. To learn more about the band, check out their Wikipedia page: https://en.wikipedia.org/wiki/One_Direction.
First, we need to load our packages. Since we are doing a lyric analysis, we will be loading the Genius package, as well as a package that will allow us to build Wordclouds.
library(tidyverse)
library(tidytext)
library(genius)
library(tibble)
library(devtools)
library(wordcloud2)
Now that the packages have been loaded, the 5 albums will need to be loaded from the Genius library. Creating the variable called “onedirection” will consolidates all the albums together. Furthermore, there needs to be a variable for the lyrics in all the albums, which will be represented as “onedirection_lyrics”.
onedirection <- tribble(
~ artist, ~ title,
"One Direction", "Up All Night",
"One Direction", "Take Me Home",
"One Direction", "Midnight Memories",
"One Direction", "FOUR",
"One Direction", "Made in the A.M."
)
onedirection_lyrics <- onedirection %>%
add_genius(artist, title, type = "album")
Now the most common words and their frequency can be analyzed. Using the “stop_words” command will remove words such as “a” and “and” that are not very representative of the actual content of the albums. After removing the stop words, a table of the Top 10 most common words in One Direction’s albums can be generated.
onedirection_lyrics %>%
unnest_tokens(word, lyric) %>%
anti_join(stop_words) %>%
count(word, sort = TRUE)%>%
head(10)%>%
knitr::kable()
| word | n |
|---|---|
| baby | 238 |
| yeah | 228 |
| na | 207 |
| wanna | 198 |
| love | 174 |
| heart | 125 |
| night | 112 |
| time | 86 |
| tonight | 86 |
| girl | 83 |
It can be seen from the table that the “stop_words” command did not take out words like “na” and “yeah”. Though those words aren’t necessarily meaningful in terms of content, their frequency shows a lot about the pop, boy-band tone of the music. The table was limited at 10 words, because it would be a huge table otherwise, so to get a bigger picture of some of the other common words used in One Direction’s albums, a word cloud was used for a visual representation.
onedirection_lyrics %>%
unnest_tokens(word,lyric)%>%
anti_join(stop_words)%>%
count(word, sort=TRUE)%>%
wordcloud2()
A similar process was used to analyze the album’s of the band member’s solo careers. First Harry Styles’s two albums, “Harry Styles” and “Fine Line” were loaded and a variable was created to represent the lyrics.
harrystyles <- tribble(
~ artist, ~ title,
"Harry Styles", "Harry Styles",
"Harry Styles", "Fine Line",
)
harrystyles_lyrics <- harrystyles %>%
add_genius(artist, title, type = "album")
Next, the Top 10 words in his two albums were found and put into a table.
harrystyles_lyrics %>%
unnest_tokens(word, lyric) %>%
anti_join(stop_words) %>%
count(word, sort = TRUE)%>%
head(10)%>%
knitr::kable()
| word | n |
|---|---|
| golden | 41 |
| la | 39 |
| home | 27 |
| sugar | 27 |
| wanna | 27 |
| baby | 25 |
| call | 25 |
| watermelon | 25 |
| da | 24 |
| angel | 23 |
The Top 10 words were then visualized in a word cloud.
harrystyles_lyrics %>%
unnest_tokens(word,lyric)%>%
anti_join(stop_words)%>%
count(word, sort=TRUE)%>%
wordcloud2()
Conclusion: One Direction and Harry Styles shared 2 common words amid the two sets of albums, which were “wanna” and “baby.”
Niall Horan’s albums, “Flicker” and “Heartbreak Weather” were loaded into R and the variable for the lyrics was created: “niallhoran_lyrics”.
niallhoran <- tribble(
~ artist, ~ title,
"Niall Horan", "Flicker",
"Niall Horan", "Heartbreak Weather",
)
niallhoran_lyrics <- niallhoran %>%
add_genius(artist, title, type = "album")
The Top 10 most common words were then found.
niallhoran_lyrics %>%
unnest_tokens(word, lyric) %>%
anti_join(stop_words) %>%
count(word, sort = TRUE)%>%
head(10)%>%
knitr::kable()
| word | n |
|---|---|
| love | 62 |
| yeah | 50 |
| time | 35 |
| coming | 31 |
| heart | 27 |
| eyes | 26 |
| wanna | 25 |
| feels | 22 |
| night | 21 |
| mind | 20 |
The words were then put into a word cloud.
niallhoran_lyrics %>%
unnest_tokens(word,lyric)%>%
anti_join(stop_words)%>%
count(word, sort=TRUE)%>%
wordcloud2()
Conclusion: One Direction and Niall Horan shared 6 common words amid the two sets of albums, which were “love”, “yeah”, “time”, “heart”, “wanna”, and night". That is three times more than Harry Styles had in common with One Direction.
Louis Tomlinson only has one album, “Walls,” so it was the only one that needed to be loaded to create the variable.
louistomlinson <- tribble(
~ artist, ~ title,
"Louis Tomlinson", "Walls",
)
louistomlinson_lyrics <- louistomlinson %>%
add_genius(artist, title, type = "album")
A Top 10 most common words table was generated.
louistomlinson_lyrics %>%
unnest_tokens(word, lyric) %>%
anti_join(stop_words) %>%
count(word, sort = TRUE)%>%
head(10)%>%
knitr::kable()
| word | n |
|---|---|
| yeah | 55 |
| ooh | 50 |
| break | 30 |
| life | 25 |
| heart | 23 |
| kill | 23 |
| time | 16 |
| day | 15 |
| defenceless | 15 |
| ah | 14 |
A word cloud was generated.
louistomlinson_lyrics %>%
unnest_tokens(word,lyric)%>%
anti_join(stop_words)%>%
count(word, sort=TRUE)%>%
wordcloud2()
Conclusion: One Direction and Louis Tomlinson shared 3 common words amid the two sets of albums, which were “yeah”, “heart”, and “time”. Louis only has half the overlap as Niall, but still more than Harry.
Liam Payne also only has one album, “LP1” that needed to be loaded into R.
liampayne <- tribble(
~ artist, ~ title,
"Liam Payne", "LP1",
)
liampayne_lyrics <- liampayne %>%
add_genius(artist, title, type = "album")
A Top 10 list of the most common words on the album was generated. As seen in the code, the word “ed” was removed because it was used as an extension of thee word “bed” (“bed-ed-ed” in the lyrics).
liampayne_lyrics %>%
unnest_tokens(word, lyric) %>%
anti_join(stop_words) %>%
filter(!word %in% "ed")%>%
count(word, sort = TRUE)%>%
head(10)%>%
knitr::kable()
| word | n |
|---|---|
| yeah | 172 |
| love | 51 |
| baby | 46 |
| low | 46 |
| wanna | 39 |
| girl | 34 |
| lie | 34 |
| friends | 32 |
| time | 32 |
| ooh | 28 |
The words from the album were then put into a word cloud.
liampayne_lyrics %>%
unnest_tokens(word,lyric)%>%
anti_join(stop_words)%>%
count(word, sort=TRUE)%>%
wordcloud2()
Conclusion: One Direction and Liam Payne shared 6 common words amid the two sets of albums, which were “yeah”, “love”, “baby”, “wanna”, “girl”, and “time”. Liam has the same amount of overlap as Niall.
Zayn has more albums than any of the other members, likely due to leaving the band earlier than the others. Zayn’s albums, “Mind of Mine”, “Icarus Falls”, and “Nobody Is Listening” were loaded into R.
zayn <- tribble(
~ artist, ~ title,
"ZAYN", "Mind of Mine",
"ZAYN", "Icarus Falls",
"ZAYN", "Nobody Is Listening"
)
zayn_lyrics <- zayn %>%
add_genius(artist, title, type = "album")
The most common words were put into a table.
zayn_lyrics %>%
unnest_tokens(word, lyric) %>%
anti_join(stop_words) %>%
count(word, sort = TRUE) %>%
head(10)%>%
knitr::kable()
| word | n |
|---|---|
| love | 175 |
| ooh | 108 |
| wanna | 90 |
| time | 85 |
| burn | 77 |
| yeah | 71 |
| ya | 60 |
| baby | 51 |
| girl | 48 |
| mind | 46 |
The words were then visualized in a word cloud.
zayn_lyrics %>%
unnest_tokens(word,lyric)%>%
anti_join(stop_words)%>%
count(word, sort=TRUE)%>%
wordcloud2()
Conclusion: One Direction and Zayn Malik shared 6 common words amid the two sets of albums, which were “love”, “wanna”, “time”, “yeah”, “baby”, and “girl”. Zayn had the same amount of overlap as Niall and Liam.
It is very interesting to see how much overlap there was between band and solo albums. Niall Horan, Liam Payne, and Zayn Malik had the most overlap, with 6 words each. Louis Tomlinson had 3 overlapping words and Harry Styles only had 2.
Of those words, “yeah”, “wanna”, and “time” were found in the Top 10 of 4 of the solo artists.
“Baby” was in the Top 10 of 3 of the solo artists.
“Love”, “heart”, and “girl” were used in the Top 10 of 2 of the solo artists.
“Night” was found in the Top 10 of 1 solo artist.