Blog

A Look into my music listening with dplyr and plot.ly

image

I listen to a good quantity and variety of music. I work in a field where listening to music on the job is OK, so it’s not uncommon that I will listen to 5 hours of music in a day while working. I don’t listen to music as much while driving, because I listen to a lot of audio books and like to catch the news when I can. In any event, I recently came across an IFTTT recipe that would take tracks that were scrobbled (recorded) by Last.fm and put store it in a Google Spread Sheet. I forgot that I had this running over the last 6 months and there were over 2000 entries in there. I decided to take a look at the data and see if there were any interesting trends I could find in the data. the data is simple, the date, the name of the band, the song, a link to the album cover and a link to the songs Last.fm page.

The Approach

First thing I needed to do was handle the data formatting in the date column: Just looking at it I didn’t imagine: March 23, 2014 at 03:30PM was going to be a date format that was going to make R very happy. With some regular expressions in Google sheets I got that done relatively easily. Now I just wanted to do some quick magic with dplyr to look at this data couple different ways.

Overall Artists:


I’m surprised Canibus is number one, but I was preparing for this podcast and Canibus does have hefty music catalog.


Count over months:




Day of the week:


Not surprisingly I listen to the majority of music on weekdays. I also like do a bit of it on Sundays. I do often spend Sunday mornings at my desk writing blogs like this one.



Overall, it was fun to look at this data in this way. It’s not sophisticated by any means but it’s an interesting break down and not very much code to do it. I would recommend using the Last.FM API over this IFTTT method just because that’s a cleaner way of doing it and you get a richer dataset. That being said, you can find out a lot from this method without much code. Dplyr is also the best thing that happened to R in a while.

Here’s my favorite album over the course of the last few months: Note: Some of the music services I use don’t work with last.fm on mobile and hence this set of data is just my listening at the computer. I do spend the majority of my day there so it’s not a bad representation of what I listen to. 

Jowanza JosephData, Featured