Note that the code in the repo may not work as certain data is not public due to Spotify Developer Terms of Service.
The original data set was downloaded from the Spotify Million Playlist Challenge. The dataset was then expanded through the Spotify Web API, using Python. This expansion is still in progress; for instance, there are few tracks from 2021.
There is some odd data; for instance, sometimes year
has a value of 0000
, a tempo
of 0, or a loudness
of -60 (silent). However, these are not necessarily incorrect as some tracks are so short, a tempo cannot be determined and some tracks are actually tracks of silence. As such, we have not removed all zeros nor "corrected" any values.
To explore the code, clone this repository and use the make_feather.R
script to create your own feather file (the file is too big to store here). For faster loading times, we recommend using the spotify_testing.feather
to load instead (there is a commented out section app.R
for this purpose). Everything is set up for proper use with the feather files; all you need to do is run the script and everything should be all set. Similarly, the Shiny app published online only uses a subset of the full data due to file size concerns. At a point in the future, we would like to connect to a database but as of right now this has not been integrated.
Description of the variables is as follows. Most are taken directly from the Spotify API Documentation on Getting Tracks and Getting Track Features).
Variable Name | Type | Possible Values | Explanation |
---|---|---|---|
album_uri |
chr | NA | Uniform Resource Indicator, ID reference to a Spotify album page |
artist_uri |
chr | NA | Uniform Resource Indicator, ID reference to a Spotify artist page |
artist_name |
chr | NA | Name of the artist or artists on a track |
album_name |
chr | NA | Name of the album a track is found on |
release_date |
date | 1885-2021 | Release date of the track (ymd or y) |
disc_number |
int | 1 - inf | Disc number the track is found on |
popularity |
int | 0 - 100 | 100 is the most popular. The popularity is calculated by algorithm and is based, in the most part, on the total number of plays the track has had and how recent those plays are. Generally speaking, songs that are being played a lot now will have a higher popularity than songs that were played a lot in the past. Duplicate tracks (e.g. the same track from a single and an album) are rated independently. |
track_number |
int | 1 - inf | Track number on album |
duration |
int | 0 - inf | The duration of a track in milliseconds |
explicit |
logi | FALSE/TRUE | Whether or not the track has explicit lyrics (true = yes it does; false = no it does not OR unknown). |
track_name |
chr | NA | Name of the track |
track_uri |
chr | NA | Uniform Resource Indicator, ID reference to a Spotify track |
danceability |
num | 0 - 1 | How suitable a track is for dancing based on a combination of musical elements including tempo, rhythm stability, beat strength, and overall regularity. A value of 0.0 is least danceable and 1.0 is most danceable. |
energy |
num | 0 - 1 | Represents a perceptual measure of intensity and activity. Typically, energetic tracks feel fast, loud, and noisy. For example, death metal has high energy, while a Bach prelude scores low on the scale. Perceptual features contributing to this attribute include dynamic range, perceived loudness, timbre, onset rate, and general entropy. |
key |
int | 0 - 11 | The key the track is in. Integers map to pitches using standard Pitch Class notation. E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on. If no key was detected, the value is -1. |
loudness |
int | -60 - inf | The overall loudness of a track in decibels (dB). Loudness values are averaged across the entire track and are useful for comparing relative loudness of tracks. Loudness is the quality of a sound that is the primary psychological correlate of physical strength (amplitude). Will rarely go above 0. |
mode |
binary | 0, 1 | Indicates the modality (major or minor) of a track, the type of scale from which its melodic content is derived. Major is represented by 1 and minor is 0. |
speechiness |
num | 0 - 1 | Detects the presence of spoken words in a track. The more exclusively speech-like the recording (e.g. talk show, audio book, poetry), the closer to 1.0 the attribute value. Values above 0.66 describe tracks that are probably made entirely of spoken words. Values between 0.33 and 0.66 describe tracks that may contain both music and speech, either in sections or layered, including such cases as rap music. Values below 0.33 most likely represent music and other non-speech-like tracks. |
acousticness |
num | 0 - 1 | A confidence measure of whether the track is acoustic. 1.0 represents high confidence the track is acoustic. |
liveness |
num | 0 - 1 | Detects the presence of an audience in the recording. Higher liveness values represent an increased probability that the track was performed live. A value above 0.8 provides strong likelihood that the track is live. |
valence |
num | 0 - 1 | A measure describing the musical positiveness conveyed by a track. Tracks with high valence sound more positive (e.g. happy, cheerful, euphoric), while tracks with low valence sound more negative (e.g. sad, depressed, angry). |
tempo |
num | 0 - 250 | The overall estimated tempo of a track in beats per minute (BPM). In musical terminology, tempo is the speed or pace of a given piece and derives directly from the average beat duration. |
time_signature |
int | 0 - 7 | An estimated time signature. The time signature (meter) is a notational convention to specify how many beats are in each bar (or measure). The time signature ranges from 3 to 7 indicating time signatures of "3/4", to "7/4" |
instrumentalness |
int | 0 - 1 | Predicts whether a track contains no vocals. "Ooh" and "aah" sounds are treated as instrumental in this context. Rap or spoken word tracks are clearly "vocal". The closer the instrumentalness value is to 1.0, the greater likelihood the track contains no vocal content. Values above 0.5 are intended to represent instrumental tracks, but confidence is higher as the value approaches 1.0. |