This final project will explore Kendrick Lamar’s discography

I will explore how Kendrick Lamar’s music has become less upbeat and slightly more depressing over the course of his four studio albums. Lamar’s sound in a couple of his songs has become more somber and less upbeat as his career has progressed due to being in the spotlight and dealing with addiction and struggling with his mental health. According to hiphopunrapped.com Lamar experienced an inner conflict as he questioned his role as a public figure; he didn’t know how he could perform to fans across the globe while feeling guilty for being unable to help his friend and family members who were struggling with death and pregnancy in Compton. Following his first album, “Kendrick fell into a deep depression that gave us his next album, To Pimp A Butterfly. I will be examining three of his studio albums, good kid, m.A.A.d city (2012), To Pimp A Butterfly (2015), and DAMN. (2017), and his one compilation album untitled unmastered. (2016) with the help of online sources and Spotify. Analyzing four of his albums can be useful to show how his music has changed and how his fame has increased over time. I will also examine the energy, danceability and valence rates of each album to see if there are significant changes in these rates from 2012 to 2017. I will use Spotify API and research from the internet to obtain my necessary API. I received Lamar’s lyrics in a JSON file from Professor Walsh so I turned it into a datafile.

I hypothesize that Lamar’s albums will start positive and his albums will gradually become more negative and depressing over time due to his position in the public spotlight while grappling with social and personal issues, which will coincide with a change from high to low energy and danceability rate and will have a positive to negative sentiment analysis over the span of his four albums.

Pictured above is Kendrick Lamar. Image from lithub.com

This document will include explicit content.

First, I will download the necessary packages:

library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5     ✓ purrr   0.3.4
## ✓ tibble  3.1.6     ✓ dplyr   1.0.8
## ✓ tidyr   1.2.0     ✓ stringr 1.4.0
## ✓ readr   2.1.2     ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(spotifyr)
library(tidytext)
## 
## Attaching package: 'tidytext'
## The following object is masked from 'package:spotifyr':
## 
##     tidy
library(textdata)
library(ggjoy)
## Loading required package: ggridges
## The ggjoy package has been deprecated. Please switch over to the
## ggridges package, which provides the same functionality. Porting
## guidelines can be found here:
## https://github.com/clauswilke/ggjoy/blob/master/README.md
library(ggridges)
library(knitr)
library(genius)
library(ggthemes)
library(jsonlite)
## 
## Attaching package: 'jsonlite'
## The following object is masked from 'package:purrr':
## 
##     flatten
library(vembedr)
library(wordcloud2)

I uploaded the code to tell R where to look for my Kendrick Lamar folder.

setwd("~/Desktop/KL")

Below, is a video of young Lamar talking about his music, dated October 20, 2010.

This video contains Lamar talking about his music before the release of his four albums. He talks about how he aspires to be the “best rapper” and respects his competition. You can see the passion he has as a young rapper and how he is excited to start his career and become the best.

suggest_embed("https://www.youtube.com/watch?v=6_WIciXu3Tg") 
## embed_youtube("6_WIciXu3Tg")
  embed_url("https://www.youtube.com/watch?v=6_WIciXu3Tg")

Next, I am going to look at each album!

good kid, m.A.A.d city (2012)

To begin, I turned the album into a datafile.

kid <- fromJSON("Lyrics_goodkidm.A.A.dcity.json")
as.data.frame(kid) -> kid_df
kid_df$tracks.song -> kidlyrics

kidlyrics %>%
  unnest_tokens(word, lyrics) -> kid

Let’s look at how many words are in this album.

kid %>% 
  count()
##       n
## 1 12089

12089 words are in good kid, m.A.A.d city. Now lets look at the most popular words.

kid %>%
  anti_join(stop_words) %>%
  count(word, sort = TRUE) %>% 
  filter(!word %in% c("tahm", "igh","kendrick", "lamar", "verse", "chorus", "1", "2")) %>% 
  head(20) %>%
  knitr::kable()
## Joining, by = "word"
word n
nigga 77
love 59
real 58
sing 44
bitch 39
shit 38
life 35
drank 34
feel 33
fuck 33
promise 31
kill 30
song 28
city 27
vibe 27
ya 27
gon 26
bish 24
niggas 24
day 22
kid %>%
  anti_join(stop_words) %>%
  count(word, sort = TRUE) %>% 
  inner_join(get_sentiments("afinn")) %>%
  inner_join(get_sentiments("bing")) %>% 
  filter(!word %in% c("tahm", "igh","kendrick", "lamar", "verse", "chorus", "1", "2")) %>% 
  head(20) %>% 
  knitr::kable() -> kidsentiment
## Joining, by = "word"
## Joining, by = "word"
## Joining, by = "word"
kidsentiment  
word n value sentiment
love 59 3 positive
bitch 39 -5 negative
shit 38 -4 negative
fuck 33 -4 negative
promise 31 1 positive
kill 30 -3 negative
damn 21 -4 negative
tired 15 -2 negative
die 12 -3 negative
hate 8 -3 negative
pain 7 -2 negative
top 7 2 positive
bad 6 -3 negative
dead 6 -3 negative
dick 6 -4 negative
free 6 1 positive
killed 6 -3 negative
broke 5 -1 negative
proud 5 2 positive
rich 5 2 positive

‘Love’ is one of the most popular words because this album is a coming-of-age story about battling growing up and gang violence while trying to love oneself. The album includes a song in which Lamar reflects on being baptized and finding himself. In addition, this album consists of songs that discuss gang life and the struggle of deciding whether to stray from the gang and receive no protection, or stay with the gang and become more involved in violence. Thus, it is appropriate that the songs featured in this album include some negative words as he is trying to make this decision. The most popular word in the album is ’N***a’and it is commonly used in rap songs sung by African Americans.

Bitch has a negative sentiment of -5, which means that it is an aggressive term that carries a lot of value. ‘Love’ has a sentiment of 3, which is appropriate given that this album is about Kendrick’s attempt to find himself. Overall, this album seems to have a more negative sentiment. The upbeat sound of Kendrick’s songs contrast, this negative sentiment, and the many challenges he faces as he matures.

Let’s download the album from the Spotify API

Sys.setenv(SPOTIFY_CLIENT_ID = 'cfe386975d294646aca48ec58729cb9c')
Sys.setenv(SPOTIFY_CLIENT_SECRET = '8a254c0dc3e945cf85541e94995cda31')

library(readr)
lamar <- read_csv("~/Desktop/KL/lamar.csv")
## Rows: 87 Columns: 39
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (18): artist_name, artist_id, album_id, album_type, album_release_date, ...
## dbl (16): album_release_year, danceability, energy, key, loudness, mode, spe...
## lgl  (5): album_images, artists, available_markets, explicit, is_local
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
access_token <- get_spotify_access_token()
kendricklamar <- get_artist_audio_features('Kendrick Lamar')
lamar %>% 
  filter(album_name %in% "good kid, m.A.A.d city")-> kidalbum
lamar %>% 
  filter(album_name %in% "good kid, m.A.A.d city") %>% 
  select(danceability, album_name, energy, track_name) %>% 
  kable()
danceability album_name energy track_name
0.503 good kid, m.A.A.d city 0.508 Sherane a.k.a Master Splinter’s Daughter
0.587 good kid, m.A.A.d city 0.698 Bitch, Don’t Kill My Vibe
0.546 good kid, m.A.A.d city 0.651 Backseat Freestyle
0.555 good kid, m.A.A.d city 0.611 The Art of Peer Pressure
0.716 good kid, m.A.A.d city 0.531 Money Trees
0.779 good kid, m.A.A.d city 0.572 Poetic Justice
0.451 good kid, m.A.A.d city 0.831 good kid
0.487 good kid, m.A.A.d city 0.729 m.A.A.d city
0.716 good kid, m.A.A.d city 0.485 Swimming Pools (Drank) - Extended Version
0.654 good kid, m.A.A.d city 0.753 Sing About Me, I’m Dying Of Thirst
0.652 good kid, m.A.A.d city 0.458 Real
0.342 good kid, m.A.A.d city 0.907 Compton
0.616 good kid, m.A.A.d city 0.778 Bitch, Don’t Kill My Vibe - Remix

The energy on this album is low for some songs likely because of their slower tempo. The song with the lowest energy is “Real”, which is not very upbeat and consists of a very slow consistent tempo. Overall, this album has a few songs that have good energy because many of Kendrick’s songs have an upbeat tune and reflect the musical energy that Kendrick’s fans enjoy listening to. The energy is unexpected given that there are a lot of negative sentiment words on the album. For example, ‘bitch’ is one of the common negative terms featured in the album and is frequently used in his song, “Bitch Don’t Kill My Vibe”, which has an energy rate of 0.698. “Bitch Don’t Kill My Vibe” has one of the higher energy rates on the album. “Compton” has the highest energy rate and upbeat tempo. Overall, this debut album set off Lamar’s career and sparked his popularity amongst fans across the world.

kidalbum%>% 
arrange(desc(energy))%>%
  ggplot(aes(track_name, energy, fill= track_name)) + geom_col() +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),legend.position = "none") + 
  coord_flip() +
   ggtitle("Energy of Kendrick Lamar's Album, good kid, m.A.A.d city")

Now let’s look at the albums valence.

kidalbum %>%
  filter(album_name %in% "good kid, m.A.A.d city") %>%
  ggplot(aes(reorder(track_name, valence), valence) ) + geom_col() +
  coord_flip() +
  theme_economist()+
   ggtitle("Valence of Kendrick Lamar's Album, good kid, m.A.A.d city")

The valence of this album starts off high, and then gradually decreases to 0.1. This shows that the songs with higher valence are more upbeat, happier songs, and the album gradually becomes more depressing. “Poetic Justice” and “Backseat Freestyle” have the highest valence rates, which aligns with their upbeat tempos that have happier/positive sounds.

To Pimp A Butterfly (2015)

butterfly <- fromJSON("Lyrics_ToPimpaButterfly.json")
as.data.frame(butterfly) -> butterfly_df
butterfly_df$tracks.song -> butterflylyrics

butterflylyrics %>%
  unnest_tokens(word, lyrics) -> butterfly 

Let’s look at the word count and the most popular words featured in Kendrick Lamar’s album, To Pimp A Butterfly.

butterfly %>% 
count()
##       n
## 1 13682
butterfly %>%
  anti_join(stop_words) %>%
  count(word, sort = TRUE) %>% 
  filter(!word %in% c("tahm", "igh","kendrick", "lamar", "verse", "chorus", "1", "2")) %>% 
  head(20) %>%
  knitr::kable()
## Joining, by = "word"
word n
nigga 90
love 62
shit 53
black 46
gon 43
fuck 35
gotta 35
wanna 32
fan 31
walls 31
i’m 30
alright 29
talk 29
boo 27
lie 27
time 27
zoom 27
funk 26
niggas 25
hit 24

The word count on this album is 13682. This album has the same two most popular words as Lamar’s first album, good kid, m.A.A.d city. This is not surprising because Kendrick Lamar tries to preach self-love in his albums, while also discussing heavy topics such as racism, materialism, violence, substance use, mental health issues, and oppression. Like good kid, m.A.A.d city, the most popular word on this album is the n-word. While this is a sensitive and offensive word in our society, it is important to talk about it within the context of gangs, because Black artists in rap culture see it as a symbol of brotherhood and a term of endearment for their peers. According to Wikipedia, “lyrically this album features political commentary and personal themes concerning African-American culture, racial inequality, depression, and institutional depression.”

Here is a wordcloud to visualize.

butterfly %>% 
  count(word, sort = TRUE) %>% 
  anti_join(stop_words) %>% 
  filter(!word %in% c("tahm", "igh", "chorus", "verse", "kendrick", "lamar","1", "2")) %>% 
  wordcloud2()
## Joining, by = "word"
butterfly %>%
  anti_join(stop_words) %>%
  count(word, sort = TRUE) %>% 
  inner_join(get_sentiments("afinn")) %>%
  inner_join(get_sentiments("bing")) %>% 
  filter(!word %in% c("tahm", "igh","kendrick", "lamar", "verse", "chorus", "1", "2")) %>% 
  head(20) %>%
  knitr::kable() -> butterflysentiment
## Joining, by = "word"
## Joining, by = "word"
## Joining, by = "word"
butterflysentiment
word n value sentiment
love 62 3 positive
shit 53 -4 negative
fuck 35 -4 negative
loving 23 2 positive
bitch 19 -5 negative
dead 13 -3 negative
hard 12 -1 negative
free 11 1 positive
hate 11 -3 negative
dick 10 -4 negative
impress 10 3 positive
bad 7 -3 negative
kill 7 -3 negative
rich 7 2 positive
mad 6 -3 negative
poor 6 -2 negative
crazy 5 -2 negative
hurt 5 -2 negative
mistakes 5 -2 negative
bullshit 4 -4 negative

Love has a sentiment of 3 and is use 62 times within the album. It carries a lot of positive feeling. However, this album is overall negative because the term, ’n***a’, has a sentiment of -5 and ‘shit’ and ‘fuck’ both have a sentiment of -4. The low sentiments of these words and their frequent use in the album results in the album having low energy and a more depressing sound.

Spotify API

lamar %>% 
  filter(album_name %in% "To Pimp A Butterfly")-> butterflyalbum

lamar %>% 
  filter(album_name %in% "To Pimp A Butterfly") %>% 
  select(danceability, album_name, energy, track_name) %>% 
  kable()
danceability album_name energy track_name
0.509 To Pimp A Butterfly 0.787 Wesley’s Theory
0.526 To Pimp A Butterfly 0.896 For Free? - Interlude
0.884 To Pimp A Butterfly 0.657 King Kunta
0.539 To Pimp A Butterfly 0.731 Institutionalized
0.752 To Pimp A Butterfly 0.489 These Walls
0.406 To Pimp A Butterfly 0.798 u
0.796 To Pimp A Butterfly 0.766 Alright
0.301 To Pimp A Butterfly 0.686 For Sale? - Interlude
0.615 To Pimp A Butterfly 0.743 Momma
0.731 To Pimp A Butterfly 0.661 Hood Politics
0.624 To Pimp A Butterfly 0.729 How Much A Dollar Cost
0.665 To Pimp A Butterfly 0.558 Complexion (A Zulu Love)
0.553 To Pimp A Butterfly 0.852 The Blacker The Berry
0.443 To Pimp A Butterfly 0.635 You Ain’t Gotta Lie (Momma Said)
0.541 To Pimp A Butterfly 0.809 i
0.567 To Pimp A Butterfly 0.525 Mortal Man

We are going to look at danceability for this album, because it is his most liked album.

butterflyalbum %>%
  arrange(desc(danceability))%>%
  ggplot(aes(track_name, danceability, fill= track_name)) + geom_col() +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),legend.position = "none") + 
  coord_flip()+
  ggtitle("Danceability of Kendrick Lamar's Album, To Pimp A Butterfly")

The danceability on this album is somewhat scattered but has a couple songs that reach higher rates, which is appropriate given that it is Lamar’s most popular album, according to The Crimson White. Although this album has a more negative sentiment, it has very high danceability rates. “King Kunta” is an upbeat song with a fast tempo and has the highest danceability rate on this album. Overall, this album was popular on the charts, according to the LA times, and has great danceability rates with a few songs that are consistent around 0.50 rate.

butterflyalbum %>%
  filter(album_name %in% "To Pimp A Butterfly") %>%
  ggplot(aes(reorder(track_name, valence), valence) ) + geom_col() +
  coord_flip() +
  theme_economist() +
  ggtitle("Valence of Kendrick Lamar's Album, To Pimp A Butterfly")

This album has a similar valence to the good day, m.A.A.d. city album. “i” and “ For Free? - Interlude” have the highest valence of around 0.7, which is pretty high since the scale of valence is from 0-1. This means that this album is predominantly positive and does not have as many depressing tracks. It is interesting to see the valence rates decrease slowly through the album, meaning that the album gradually goes from happy to gloomy.

untitled unmastered. (2016)

unmastered <- fromJSON("Lyrics_untitledunmastered..json")
as.data.frame(unmastered) -> unmastered_df
unmastered_df$tracks.song -> unmasteredlyrics

unmasteredlyrics %>%
  unnest_tokens(word, lyrics) -> unmastered
unmastered %>% 
  count()
##      n
## 1 4988

It’s important to note that this album has fewer words than his other three albums, because this album consists of only eight songs that range from two eight minutes in length. Let’s determine what the most frequently used words are in this album.

unmastered %>%
  anti_join(stop_words) %>%
  count(word, sort = TRUE) %>% 
  filter(!word %in% c("tahm", "igh","kendrick", "lamar", "verse", "chorus", "1", "2")) %>% 
  head(20) %>%
  knitr::kable()
## Joining, by = "word"
word n
levitate 29
explain 20
pimp 17
em 16
bitch 15
nigga 15
blue 13
die 13
head 13
world 13
baby 12
shit 11
yeah 11
bam 10
god 10
gotta 10
hooray 10
truth 9
untitled 9
wanna 9
unmastered %>%
  anti_join(stop_words) %>%
  count(word, sort = TRUE) %>% 
  inner_join(get_sentiments("afinn")) %>% 
  inner_join(get_sentiments("bing")) %>% 
  filter(!word %in% c("tahm", "igh","kendrick", "lamar", "verse", "chorus", "1", "2")) %>% 
  head(20) %>%
  knitr::kable() -> unmasteredsentiment
## Joining, by = "word"
## Joining, by = "word"
## Joining, by = "word"

The most popular words are on this album are “levitate”, “explain”, “pimp”.

This album is a compilation of eight demos of unused songs from Lamar’s To Pimp A Butterfly recording sessions. He released this album to be a direct response to fans who were clamoring for more music after Lamar’s Grammy performance in February 2016. Looking at the sentiment of the album might give us a better sense of the mood of the untitled unmastered. album. It is his least liked album according to The Crimson White Lyrically, this album consists of politically charged and philosophical themes, as well as his experimentation with new sounds and styles.

Here is a sentiment analysis.

unmasteredsentiment
word n value sentiment
bitch 15 -5 negative
die 13 -3 negative
shit 11 -4 negative
fuck 8 -4 negative
bad 6 -3 negative
love 6 3 positive
top 6 2 positive
broke 5 -1 negative
crazy 5 -2 negative
luck 5 3 positive
wrong 5 -2 negative
sad 4 -2 negative
crash 3 -2 negative
fear 3 -2 negative
free 3 1 positive
hate 3 -3 negative
stuck 3 -2 negative
blessing 2 3 positive
broken 2 -1 negative
drag 2 -1 negative

untitled unmastered. has a negative sentiment which is consistent with his other albums. Most of his albums are likely negative due to having political and philosophical themes. ‘Bitch’ has a low sentiment of -5,which is the same as it was in To Pimp A Butterfly. ‘Love’ is also used in this album and has a high sentiment, but it is not one of the most popular words unlike his earlier albums.

Here is a word cloud to visualize.

unmastered %>% 
  count(word, sort = TRUE) %>% 
  anti_join(stop_words) %>% 
  filter(!word %in% c("tahm", "igh", "chorus", "verse", "kendrick", "lamar","1", "2")) %>% 
  wordcloud2()
## Joining, by = "word"

Spotify API

lamar %>% 
  filter(album_name %in% "untitled unmastered.")-> unmasteredalbum

lamar %>% 
  filter(album_name %in% "untitled unmastered.") %>% 
  select(danceability, album_name, energy, track_name) %>% 
  kable()
danceability album_name energy track_name
0.570 untitled unmastered. 0.584 untitled 01 | 08.19.2014.
0.667 untitled unmastered. 0.508 untitled 02 | 06.23.2014.
0.813 untitled unmastered. 0.549 untitled 03 | 05.28.2013.
0.512 untitled unmastered. 0.128 untitled 04 | 08.14.2014.
0.461 untitled unmastered. 0.620 untitled 05 | 09.21.2014.
0.669 untitled unmastered. 0.541 untitled 06 | 06.30.2014.
0.567 untitled unmastered. 0.463 untitled 07 | 2014 - 2016
0.850 untitled unmastered. 0.524 untitled 08 | 09.06.2014.
unmasteredalbum %>%
  arrange(desc(energy))%>%
  ggplot(aes(track_name, energy, fill= track_name)) + geom_col() +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),legend.position = "none") + 
  coord_flip()+
  ggtitle("Energy of Kendrick Lamar's Album, untitled unmastered.")

The analysis of the energy for this album shows that the energy rate is lower in comparison to good kid, m.A.A.d city Most of the songs on this album have similar energy rate except for “untitled 04”. Although this is his least liked album it still has an decently high energy rate and upbeat tune. “Untitled 05” has the highest energy rate and is the most cheerful and least dark song on this album. Overall, this album was not as popular as his previous albums, but has good energy.

unmasteredalbum %>%
  filter(album_name %in% "untitled unmastered.") %>%
  ggplot(aes(reorder(track_name, valence), valence) ) + geom_col() +
  coord_flip() +
  theme_economist()+
  ggtitle("Valence of Kendrick Lamar's Album, untitled unmastered.")

The valence on this album is similar to his previous two albums. “untitled 08” has the highest valence which means it is the happiest song on the album. “untitled 02” has the lowest valence and conveys a musical negativeness, and is depressing.

DAMN. (2017)

damn <- fromJSON("Lyrics_DAMN.json")
as.data.frame(damn) -> damn_df
damn_df$tracks.song -> damnlyrics

damnlyrics %>%
  unnest_tokens(word, lyrics) -> damn 

Now let’s look at the word count and most frequently used words in this album.

damn %>% 
  count()
##      n
## 1 9060
damn %>%
  anti_join(stop_words) %>%
  count(word, sort = TRUE) %>% 
  inner_join(get_sentiments("afinn")) %>% 
  inner_join(get_sentiments("bing")) %>% 
  filter(!word %in% c("tahm", "igh","kendrick", "lamar", "verse", "chorus", "1", "2")) %>% 
  head(20) %>%
  knitr::kable() -> damnsentiment
## Joining, by = "word"
## Joining, by = "word"
## Joining, by = "word"

The word count is 9060. This does not include the term ‘hol’ as used in the phrase “hol’ up” because it is not a real word. The most popular words are ‘feel’, ‘bitch’, and ‘love’. It is not surprising that ‘love’ is one of the most popular words given that it has also been one of the most frequently used terms in Kendrick Lamar’s previous albums. DAMN. is an “autobiographical parable in which he illustrates… his own destiny, that of the ‘greatest rapper,’” according to NPR

Let’s examine the sentiment of these words.

damnsentiment
word n value sentiment
bitch 48 -5 negative
love 45 3 positive
loyalty 38 3 positive
die 27 -3 negative
fear 26 -2 negative
shit 26 -4 negative
fuck 20 -4 negative
damn 14 -4 negative
hard 9 -1 negative
perfect 9 3 positive
sexy 9 3 positive
kill 8 -3 negative
killed 8 -3 negative
lost 8 -3 negative
trust 7 1 positive
bad 6 -3 negative
lovely 6 3 positive
murder 6 -2 negative
loyal 5 3 positive
worth 5 2 positive

This album is predominantly negative in tone based on the sentiment of the most frequently used words. Most of the words in the album have a low sentiment value because he claims the album is a “judgment of the soul.” The album consists of a song that details his own death that occurs from a blind assailant shooting him. In his pre-album single, he proclaimed he was the “greatest rapper alive” and DAMN. solidified that according to NPR.org With this knowledge, you would think that there would be an overall positive sentiment from the whole album but there is not. However, the same source says, DAMN. is a depressing album at times, as it can be quite evident that Kendrick has little to no hope left in him. The fire within him to fight against social injustice heard on To Pimp a Butterfly is seemingly replaced with a depressing realization that maybe these injustices are self-inflicted or unsolvable.”

Spotify API for DAMN.

Let’s look at the danceability.

lamar %>% 
  filter(album_name %in% "DAMN.")-> damnalbum

lamar %>% 
  filter(album_name %in% "DAMN.") %>% 
  select(danceability, album_name, energy, track_name) %>% 
  kable()
danceability album_name energy track_name
0.357 DAMN. 0.238 BLOOD.
0.638 DAMN. 0.523 DNA.
0.670 DAMN. 0.700 YAH.
0.748 DAMN. 0.705 ELEMENT.
0.746 DAMN. 0.798 FEEL.
0.658 DAMN. 0.535 LOYALTY. FEAT. RIHANNA.
0.665 DAMN. 0.535 PRIDE.
0.908 DAMN. 0.621 HUMBLE.
0.678 DAMN. 0.562 LUST.
0.800 DAMN. 0.585 LOVE. FEAT. ZACARI.
0.568 DAMN. 0.619 XXX. FEAT. U2.
0.588 DAMN. 0.479 FEAR.
0.706 DAMN. 0.557 GOD.
0.552 DAMN. 0.731 DUCKWORTH.
damnalbum %>%
  arrange(desc(danceability))%>%
  ggplot(aes(track_name, danceability, fill= track_name)) + geom_col() +
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),legend.position = "none") + 
  coord_flip()+
   ggtitle("Danceability of Kendrick Lamar's Album, DAMN.")

This album’s danceability varies but is overall relatively high. “HUMBLE.” is an upbeat song and appropriately has the highest danceability rate while “BLOOD.” has the lowest danceability rate. Compared to To Pimp A Butterfly, DAMN. has higher danceability rates overall and has very upbeat tunes. “BLOOD.” has low danceability rates, likely due to the fact it is about “Lamar telling a story in which he is shot by a blind woman that he is trying to help,” according to Wikipedia.

Now lets look at valence.

damnalbum %>%
  filter(album_name %in% "DAMN.") %>%
  ggplot(aes(reorder(track_name, valence), valence) ) + geom_col() +
  coord_flip() +
  theme_economist()+
   ggtitle("Valence of Kendrick Lamar's Album, DAMN.")

The valence from this album is high compared to Kendrick Lamar’s other albums. Most of these songs are happy but “GOD.” however, has the lowest valence, meaning it is more of a depressing song. Compared to the other lowest tracks on his other albums, “GOD.” has the highest valence rate. It is interesting to see that a song about God has such a low valence and is seen as depressing.

Finally, I will compare the valence in Lamar’s four albums

lamar <- get_artist_audio_features('Kendrick Lamar')
lamar %>%  
  group_by(album_name) %>% 
  filter(!album_name %in% c("DAMN. COLLECTORS EDITION.", "To Pimp a Butterfly", "good kid, m.A.A.d city", "untitledunmastered.")) -> lamar_music
lamar_music %>% 
 filter(!album_name %in% c("Overly Dedicated", "Section.80", "Black Panther The Album Music From And Inspired By", "Mr. Morale & The Big Steppers")) %>% 
  ggplot(aes(valence, album_name, fill = ..x..)) +
  geom_density_ridges_gradient() +
  theme_fivethirtyeight() + 
  xlim(0,1) +
  theme(legend.position = "none") +
  ggtitle("Valence of Kendrick Lamar's Albums")
## Picking joint bandwidth of 0.0745

Examining the valence over time of each track, two of the albums, To Pimp A Butterfly and DAMN., have similar changes in their valence as the albums progress. They start off depressing (low valence) then become happier (higher valence) then go back to depressing (lower valence). In comparison, good kid, m.A.A.d city and untitled unmastered. both start off a little higher on the valence scale and have ups and downs of upbeat songs to more sad and depressing tunes.

Conclusion

After doing extensive research on Kendrick Lamar’s discography, it is interesting that all four of his albums had negative sentiments. I found that in his most recent album, “DAMN.” “Kendrick is defeated on this album. He has been beaten down and is left with a tangible feeling of despair. He has been looking for answers all this time and, after all of it, he is left thinking that maybe it’s his own fault. He is truly defeated by coming to the realization that he is the cause of his own torment and anguish.” This analysis from Justin Smith suggests that Lamar was at his all-time low during his most recent album.

I was not able to prove my hypothesis due to all of his albums being overall negative in tone and subject. Lamar’s struggle with self-love as well as his discussion of topics such as racism, oppression, violence, and politics amplify the negative sentiment present in his four albums. The danceability of his albums, To Pimp A Butterfly and DAMN. are both relatively high, but one of his songs, such as “GOD.” do have low danceability rates. His two albums, good kid, m.A.A.d city and untitled unmastered. have overall high energy rates coupled with a few songs that have lower energy rates. With rap music, it is likely common to see high energy rates because rap music typically ‘hypes’ people up and boosts listeners’ energy. The valence graphs overall were interesting to examine, but at the end of each album, the sound is gloomy and not uplifting like it is in the middle of his albums. In addition, it is clear that the energy rates and danceability conflict with the sentiment analysis that was conducted for each album. Lyrically, the albums are more depressing because of the topics Lamar chose to write about. But through danceability and energy, we are able to see that the tempo and beat he uses are uplifting to listeners. Additionally, each valence bar graph shows a combination of emotions of happiness and depression expressed in his albums to demonstrate the complexity of human emotion. DAMN. has both higher valence and danceability rates compared to Lamar’s other albums. There are positive and negative songs in each album that reflect changes in Lamar’s emotions over time. Lamar will be releasing an album on May 13, 2022 and it will be interesting to see if these trends will continue in his next album.