Final Project: Independent Data Intensive Research
ETR537
Author
Jennifer Krzak
Published
December 13, 2023
Prepare
For my final project, I will be analyzing the top songs from 2023 as shown on Spotify. I have taken the data titled “Most Streamed Spotify Songs 2023” from Kaggle user “nelgiriyewithana”. The data is a list of the most famous songs for 2023 and includes the following variables and more: track name, artist(s) name, release date, audio features, and the presence of the song on Spotify, Apple Music, and Deezer playlists. Music is a large part of many people’s lives, including my own, and I was curious about the similarities between the top songs and why they were rated as such. I am aiming to analyzing the following information: What are the trends in the top streaming songs on Spotify? Are there correlations between Spotify and Apple playlists? Understanding the audience preference in terms of BPM, song key, and whether it was written in major or minor key. Does the danceability rating of a song increase as the BPM increase? How do the BPM affect a song’s danceability rating? I would also like to investigate how often certain popular artists appeared on the top list.
Define Questions
What are the correlations between the songs that appear on both Spotify and Apple playlists?
What are the preferences of the audience in terms of BPM (beats per minute), song key, or mode?
How does the danceability rating of a song correlate to the BPM of a song?
What is the correlation between the danceability of a song and its audio features?
How often did certain artists appear on the top charts for 2023?
Load Packages
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.1.3 ✔ readr 2.1.4
✔ forcats 1.0.0 ✔ stringr 1.5.0
✔ ggplot2 3.4.3 ✔ tibble 3.2.1
✔ lubridate 1.9.2 ✔ tidyr 1.3.0
✔ purrr 1.0.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
Wrangle - Playlist Presence
spotify_data <-read_csv("spotify-2023.csv")
Rows: 953 Columns: 24
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (5): track_name, artist(s)_name, streams, key, mode
dbl (17): artist_count, released_year, released_month, released_day, in_spot...
num (2): in_deezer_playlists, in_shazam_charts
ℹ 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.
Because this original data set has a lot of information, some of which I won’t be using, I am going to create data sets for only the information that I want to review. My first task will be to collect and separate the data that pertains to only the presence of the song in Spotify, Apple Music, and Deezer.
I am then going to take the information from this data set and review the first few songs to see if I can notice a correlation.
view(playlist_presence)
In reviewing the first five songs it is clear to see that the songs have a stronger presence on Spotify music as compared to both Apple and Deezer. I wonder if this is due to the cost of the subscription service, the type of device it is played on (and whether the streaming service is allowed at work or school), or if it comes down to the ease of use within the streaming service and adding it to a playlist.
I am also curious if there is a correlation between songs that appear on both the top charts and in playlists. I will specifically be looking at the Spotify lists. To do so I will be creating a new data set comprised of new variables: playlist amounts and chart amounts for each of the streaming services.
Now that I have created this new data set I am going to create a scatter plot to try and track the correlation between the presence of the song in the streaming chart and presence of the song in streaming playlists.
Although I wanted to try and visualize the data with all of the playlists and charts I needed to narrow down my thinking because with so many songs it didn’t make sense to put that into a graph as-is. Therefore, I decided to focus on the correlation between Spotify playlists and Spotify charts. In general, it seems that there is a not a lot of correlation. There appear to be a lot of songs concentrated into the bottom left corner, which indicate that the songs that did not commonly appear in Spotify playlists also did not commonly appear on Spotify charts. There were some songs that appeared very frequently on Spotify playlists, but did not appear in any of the Spotify charts. The same can be said for the inverse (charts compared to playlists).
Next, I would like to try and visualize the correlation between the the overall stream amounts of a song and the BPM (beats per minute), key, and mode (written in major or minor) to determine the song preferences of the audiences.
Wrangle - Audio Features
For this next data wrangle, I will be analzying the data of the impact of audio features on the number of streams for songs, and will organize the information into a scatter plot. First, I need to organize the information and gather it into the appropriate data set titled “audience_preferences”
Next, this information will be taken and put into a basic scatter plot.
audience_preferences
# A tibble: 953 × 5
track_name streams bpm key mode
<chr> <chr> <dbl> <chr> <chr>
1 Seven (feat. Latto) (Explicit Ver.) 141381703 125 B Major
2 LALA 133716286 92 C# Major
3 vampire 140003974 138 F Major
4 Cruel Summer 800840817 170 A Major
5 WHERE SHE GOES 303236322 144 A Minor
6 Sprinter 183706234 141 C# Major
7 Ella Baila Sola 725980112 148 F Minor
8 Columbia 58149378 100 F Major
9 fukumean 95217315 130 C# Minor
10 La Bebe - Remix 553634067 170 D Minor
# ℹ 943 more rows
While this scatter plot seems pretty disorganized, I am going to further analyze the scatter plot by coloring and sizing the different points to represent whether the song is written in a minor or major mode, and what key it is written in. The difference in keys will be represented by shape, and the difference in mode will be represented by color.
Warning: The shape palette can deal with a maximum of 6 discrete values because
more than 6 becomes difficult to discriminate; you have 11. Consider
specifying shapes manually if you must have them.
Due to the amounts of keys it was recommended to either consider changing from shapes to another format, however, since there are only two modes I decided to switch the codes to represent the following:
Despite the change the data is still hard to really make a sense of. It seems to all be pretty spread out, and there doesn’t seem to be much correlation between the streaming amount of songs and their BPM. I’d like to add in another variable to try and see if it makes a difference. Next, I will be adding in the variable of # of artists that contributed to the song creation. I will be using size to display this information.
First, I need to create another new data set that contains all of the information that I need.
# A tibble: 953 × 6
track_name artist_count streams bpm key mode
<chr> <dbl> <chr> <dbl> <chr> <chr>
1 Seven (feat. Latto) (Explicit Ver.) 2 141381703 125 B Major
2 LALA 1 133716286 92 C# Major
3 vampire 1 140003974 138 F Major
4 Cruel Summer 1 800840817 170 A Major
5 WHERE SHE GOES 1 303236322 144 A Minor
6 Sprinter 2 183706234 141 C# Major
7 Ella Baila Sola 2 725980112 148 F Minor
8 Columbia 1 58149378 100 F Major
9 fukumean 1 95217315 130 C# Minor
10 La Bebe - Remix 2 553634067 170 D Minor
# ℹ 943 more rows
Now, I will recreate the scatter plot having added in the new variable.
Even though I added another variable to the scatter plot the data seems to still be pretty inconsistent among the data points. It appears that audience members don’t have a clear preference on music and it is pretty evenly spread out.
The next set of variables that I would like to compare would be the danceability rating and the BPM to see if there is correlation between those two variables, in addition to how the features of a song contribute to its popularity.
Wrangle - Danceability & BPM
In order to analyze the danceability and BPM I will create a new data set titled “danceability”.
# A tibble: 953 × 6
bpm key mode `Artist 1` `Artist 2` `danceability_%`
<dbl> <chr> <chr> <chr> <chr> <dbl>
1 125 B Major Latto " Jung Kook" 80
2 92 C# Major Myke Towers <NA> 71
3 138 F Major Olivia Rodrigo <NA> 51
4 170 A Major Taylor Swift <NA> 55
5 144 A Minor Bad Bunny <NA> 65
6 141 C# Major Dave " Central Cee" 92
7 148 F Minor Eslabon Armado " Peso Pluma" 67
8 100 F Major Quevedo <NA> 67
9 130 C# Minor Gunna <NA> 85
10 170 D Minor Peso Pluma " Yng Lvcas" 81
# ℹ 943 more rows
I might want to use this information later so I am going to rename the data set to “separate_artists” so I can continue to evaluate the correlation of BPM and danceability %.
Let’s return to the original task, which is to see if there is a correlation between the danceability % of a song and the song’s BPM. I will be using a scatter plot here to determine if there are any correlations.
# A tibble: 953 × 5
bpm key mode `artist(s)_name` `danceability_%`
<dbl> <chr> <chr> <chr> <dbl>
1 125 B Major Latto, Jung Kook 80
2 92 C# Major Myke Towers 71
3 138 F Major Olivia Rodrigo 51
4 170 A Major Taylor Swift 55
5 144 A Minor Bad Bunny 65
6 141 C# Major Dave, Central Cee 92
7 148 F Minor Eslabon Armado, Peso Pluma 67
8 100 F Major Quevedo 67
9 130 C# Minor Gunna 85
10 170 D Minor Peso Pluma, Yng Lvcas 81
# ℹ 943 more rows
From the data above, it appears that songs that have a higher danceability rating are the songs that fall within approx. 75-125 bpm. Songs that have a very low or very high bpm are not rated as highly on a danceability scale.
Wrangle - Song Artists
The last point that I would like to look at is how often an artist appears in the data set, as either the lone writer of a song or as a featured artist. For this task, I will be utilizing the “separate_artists” data set, which was created earlier. What I’d like to do is filter a few artists to see if they appear more than once.
# A tibble: 38 × 6
bpm key mode `Artist 1` `Artist 2` `danceability_%`
<dbl> <chr> <chr> <chr> <chr> <dbl>
1 170 A Major Taylor Swift <NA> 55
2 118 <NA> Major Miley Cyrus <NA> 71
3 123 F# Major Taylor Swift <NA> 69
4 97 E Major Taylor Swift <NA> 64
5 96 F Major Taylor Swift <NA> 75
6 95 D Major Taylor Swift <NA> 60
7 122 F Major Miley Cyrus <NA> 67
8 130 <NA> Minor Taylor Swift <NA> 61
9 90 G# Major Taylor Swift <NA> 64
10 82 G# Major Taylor Swift <NA> 51
# ℹ 28 more rows
Taylor Swift, a popular artist, appeared 36 times over the course of the year 2023. Compared to another popular artist, Miley Cyrus, who appeared only twice.
# A tibble: 17 × 6
bpm key mode `Artist 1` `Artist 2` `danceability_%`
<dbl> <chr> <chr> <chr> <chr> <dbl>
1 174 F# Minor Harry Styles <NA> 52
2 95 <NA> Major Harry Styles <NA> 55
3 115 A# Major Harry Styles <NA> 71
4 99 G# Major Harry Styles <NA> 68
5 110 E Major Harry Styles <NA> 57
6 140 E Minor Harry Styles <NA> 45
7 107 B Major Harry Styles <NA> 72
8 114 D Major Harry Styles <NA> 51
9 146 <NA> Major Harry Styles <NA> 69
10 142 D# Major Harry Styles <NA> 56
11 139 <NA> Major Harry Styles <NA> 58
12 118 G Major Harry Styles <NA> 56
13 183 F Major Harry Styles <NA> 65
14 165 A Major Harry Styles <NA> 72
15 106 A Minor Harry Styles <NA> 83
16 114 E Minor Harry Styles <NA> 71
17 118 <NA> Major Harry Styles <NA> 42
Another popular artist, Harry Styles, appeared 17 times on the top charts for 2023.
Communication
Although I did not explore this in my case study, I would be curious to see if the amount of artists contributed to a song’s rating on the top lists for 2023. Overall, it appears that there are many types of music that people enjoy, and despite many different audio features it doesn’t seem to have much correlation. However, there is a slight correlation between the perceived “danceability” rating of songs and the bpm. I would be curious as to find out how they rated a song’s danceability, and if people voted on it or if it was commonly used in certain playlists created for dancing.
I would have liked to see if there could be categories for the music so it could be analyzed to see if pop was the most commonly played, or maybe if Hip Hop and country were also a top contender. I would also be curious if Spotify could curate the top lists for certain states or parts of the country to see any trends - does Michigan like Hip Hop or country better? Does religious music make the list at all? These are questions that would be interesting to answer, and this information I think could give a closer insight into what people like in terms of music.
Additional considerations for this case study would be to discover if the month a song was released would contribute to its status, or even the day it was released. Do songs on Sunday typically get more plays than Thursday release songs? If one were to delve further into the relationship between songs being on both the top charts and playlists do they notice whether songs make it onto the top charts because they were on the playlist, or vice versa?
Potential limitations of this study could be the complexity of genre and how this can play into people’s music preferences. The age of the music listeners could also be a limitation because Spotify may have a lot of listeners aged 20-40, whereas Apple music has listeners aged 45+ and therefore, would listen to different music types. How does the rate of song skipping come into play for these songs? How does the length of a song being played affect its score into the top charts lists? These are all things to keep in mind when analyzing music data, and determining what the top songs are for the year.