Unlock the Secrets of Your Favorite Spotify Songs with R

Investigate your Spotify listening patterns with this amazing package for R

Rafael Belokurows
5 min readMay 25, 2020

--

Photo by sgcdesignco on Unsplash

A few days ago I ran into this quite underrated package called SpotifyR, which pulls data from — you guessed it — Spotify. Although R undeservingly gets a bad reputation, especially when compared to Python or other “cleaner” programming languages, I find it fun to use and fairly quick to process data when we’re not working with huge data frames and thousands of data points.
Let’s dive into SpotifyR and find you what exactly it can and can’t do. As described by its developer Charlie Thompson:

SpotifyR is an R wrapper for pulling track audio features and other information from Spotify’s Web API (…) it allows you to enter an artist’s name and retrieve their entire discography in seconds, along with Spotify’s audio features and track/album popularity metrics.

There are a few steps related to setting up your Spotify Developer account if you don’t have one already:

  1. Login with your Spotify account here (create one if you don’t have it):
    https://developer.spotify.com/dashboard/login
  2. On your Dashboard, create a project with something along the lines of:

--

--

Rafael Belokurows

Data Nerd, Compulsive Reader, Coffee-drinker, interested in pretty much all things IT