#The message=FALSE, warning=FALSE arguments are used to suppress unnecessary messages and warnings
# Loading packages
library(tidyverse) # For data manipulation and analysis
The problem at hand involves analyzing Spotify genre data to obtain meaningful understanding of the musical preferences and trends within the platform. Understanding user preferences in terms of genres is crucial for Spotify’s success, as it directly impacts recommendations, personalized playlists, and overall user experience. This analysis aims to uncover patterns and relationships within the genre data that can inform decision-making and enhance the platform’s ability to cater to diverse musical tastes.
To address this problem, I will leverage a dataset containing information about user interactions with different genres on Spotify. The dataset will include playlist genre, danceability, energy, loudness, instrumentalness, and other relevant factors. I plan to use data analysis techniques to get relevant info from the data.
The analysis aims to provide valuable insights for Spotify. By understanding user preferences, Spotify can refine its recommendation algorithms, tailor playlists, and curate content that resonates with the users. This not only enhances user satisfaction but also contributes to increased user engagement.
## 'data.frame': 32833 obs. of 23 variables:
## $ track_id : chr "6f807x0ima9a1j3VPbc7VN" "0r7CVbZTWZgbTCYdfa2P31" "1z1Hg7Vb0AhHDiEmnDE79l" "75FpbthrwQmzHlBJLuGdC7" ...
## $ track_name : chr "I Don't Care (with Justin Bieber) - Loud Luxury Remix" "Memories - Dillon Francis Remix" "All the Time - Don Diablo Remix" "Call You Mine - Keanu Silva Remix" ...
## $ track_artist : chr "Ed Sheeran" "Maroon 5" "Zara Larsson" "The Chainsmokers" ...
## $ track_popularity : int 66 67 70 60 69 67 62 69 68 67 ...
## $ track_album_id : chr "2oCs0DGTsRO98Gh5ZSl2Cx" "63rPSO264uRjW1X5E6cWv6" "1HoSmj2eLcsrR0vE9gThr4" "1nqYsOef1yKKuGOVchbsk6" ...
## $ track_album_name : chr "I Don't Care (with Justin Bieber) [Loud Luxury Remix]" "Memories (Dillon Francis Remix)" "All the Time (Don Diablo Remix)" "Call You Mine - The Remixes" ...
## $ track_album_release_date: chr "2019-06-14" "2019-12-13" "2019-07-05" "2019-07-19" ...
## $ playlist_name : chr "Pop Remix" "Pop Remix" "Pop Remix" "Pop Remix" ...
## $ playlist_id : chr "37i9dQZF1DXcZDD7cfEKhW" "37i9dQZF1DXcZDD7cfEKhW" "37i9dQZF1DXcZDD7cfEKhW" "37i9dQZF1DXcZDD7cfEKhW" ...
## $ playlist_genre : chr "pop" "pop" "pop" "pop" ...
## $ playlist_subgenre : chr "dance pop" "dance pop" "dance pop" "dance pop" ...
## $ danceability : num 0.748 0.726 0.675 0.718 0.65 0.675 0.449 0.542 0.594 0.642 ...
## $ energy : num 0.916 0.815 0.931 0.93 0.833 0.919 0.856 0.903 0.935 0.818 ...
## $ key : int 6 11 1 7 1 8 5 4 8 2 ...
## $ loudness : num -2.63 -4.97 -3.43 -3.78 -4.67 ...
## $ mode : int 1 1 0 1 1 1 0 0 1 1 ...
## $ speechiness : num 0.0583 0.0373 0.0742 0.102 0.0359 0.127 0.0623 0.0434 0.0565 0.032 ...
## $ acousticness : num 0.102 0.0724 0.0794 0.0287 0.0803 0.0799 0.187 0.0335 0.0249 0.0567 ...
## $ instrumentalness : num 0.00 4.21e-03 2.33e-05 9.43e-06 0.00 0.00 0.00 4.83e-06 3.97e-06 0.00 ...
## $ liveness : num 0.0653 0.357 0.11 0.204 0.0833 0.143 0.176 0.111 0.637 0.0919 ...
## $ valence : num 0.518 0.693 0.613 0.277 0.725 0.585 0.152 0.367 0.366 0.59 ...
## $ tempo : num 122 100 124 122 124 ...
## $ duration_ms : int 194754 162600 176616 169093 189052 163049 187675 207619 193187 253040 ...
## track_name track_artist
## 1 I Don't Care (with Justin Bieber) - Loud Luxury Remix Ed Sheeran
## 2 Memories - Dillon Francis Remix Maroon 5
## 3 All the Time - Don Diablo Remix Zara Larsson
## 4 Call You Mine - Keanu Silva Remix The Chainsmokers
## 5 Someone You Loved - Future Humans Remix Lewis Capaldi
## 6 Beautiful People (feat. Khalid) - Jack Wins Remix Ed Sheeran
## track_popularity playlist_genre danceability energy key loudness mode
## 1 66 pop 0.748 0.916 6 -2.634 1
## 2 67 pop 0.726 0.815 11 -4.969 1
## 3 70 pop 0.675 0.931 1 -3.432 0
## 4 60 pop 0.718 0.930 7 -3.778 1
## 5 69 pop 0.650 0.833 1 -4.672 1
## 6 67 pop 0.675 0.919 8 -5.385 1
## speechiness acousticness instrumentalness liveness valence tempo
## 1 0.0583 0.1020 0.00000000 0.0653 0.518 122.036
## 2 0.0373 0.0724 0.00421000 0.3570 0.693 99.972
## 3 0.0742 0.0794 0.00002330 0.1100 0.613 124.008
## 4 0.1020 0.0287 0.00000943 0.2040 0.277 121.956
## 5 0.0359 0.0803 0.00000000 0.0833 0.725 123.976
## 6 0.1270 0.0799 0.00000000 0.1430 0.585 124.982
## duration_ms
## 1 194754
## 2 162600
## 3 176616
## 4 169093
## 5 189052
## 6 163049
The original variable had 23 variables and the cleaned data set has 16. All variables I felt that were not needed I deleted them, the columns that were deleted were:
The reason why I deleted these variables was because they were either repeating information or were variables that could not be used in making visualization. I also changed the format from scientific notation to normal in the instrumentalness column. The data set initially had 15 missing values but I got rid of them using the na.omit function.
The problem addressed in this analysis is to explore and understand the characteristics of songs in a Spotify dataset. Key aspects include identifying the top artists, analyzing the relationship between song features like danceability, duration, popularity, and presenting insights that are valuable for stakeholders.
The methodology employed involved loading and cleaning the Spotify dataset, including handling missing values and formatting variables. Techniques such as creating visualizations (scatter plots and bar graphs were used to showcase relationships between variables. The top artists and songs were identified based on specific criteria.
Insights gained from the analysis include identifying the most popular artists and songs, understanding the relationship between danceability and popularity, and visualizing the distribution of song durations. These insights provide a comprehensive view of user preferences and the characteristics of popular songs on the Spotify platform.
For the consumer of this analysis, such as music streaming platforms or marketers, the insights offer valuable information for personalized recommendations, and targeted advertising. Understanding the characteristics of popular songs can guide strategic decision-making to enhance user engagement and satisfaction.
Some limitations are that trends in music preferences and features may change over time, and the dataset’s timeframe may influence the analysis results. Also external factors influencing song popularity, such as marketing campaigns or external events, are not accounted for in the analysis.