This R Shiny dashboard displays data about songs that are played via Amazon Alexa. The data is stored in Google Spreadsheets via an IFTTT application. The dashboard contains four tabs: Frequency Plot, Year to Year Popularity, Top Songs Played, and About. The user can group frequency plots based on four different time units: Day, Week, Month, and Day of Week. The Year to Year Popularity tab contains a bump chart that can be grouped based on the top five most popular Artists or Albums played. The entire dashboard can be filtered with a date range.
I played each song via the Amazon Alexa with the voice command, “Alexa, play [genre] music, or Alexa, play music by [artist].” When each song begins playing, the IFTTT application adds a new record to a google sheet using the Keep a Google spreadsheet of the songs you listen to on Alexa applet. The google sheet consists of four columns with no headers (Example below).
Example Record:
Field | Value |
---|---|
Date and Time | March 15, 2018 at 06:56PM |
Artists | Modest Mouse |
Song | Dashboard |
Album | We Were Dead Before The Ship Even Sank [Explicit] |
I load the google sheet into R using the Google Sheets R API then apply the following transformations to the data:
- The data frame is given column names (date_time, artist, song, album).
- Each record in the Date and Time column is converted from a character to a POSIXct date-time object.
- The artist column is split into two columns (main_artist and featuring).
- The song and album columns are cleaned to no longer have [Explicit], [Clean], (Album Version), etc tags. This allows for clean, explicit, and live versions of a song or album to be grouped together and counted as the same album.
- Date, Week_Day, Week, Month, Year, and Time columns are added to the data frame.
- Skipped songs are removed from the data. If two or more songs contain the same date-time stamp, only the last song is kept.
Resulting Record:
Field | Value |
---|---|
date_time | 2018-03-15 18:56:00 |
main_artist | Modest Mouse |
featuring | NA |
song | Dashboard |
album | We Were Dead Before The Ship Even Sank |
Date | 2018-03-15 |
Week_Day | Thu |
Week | 11 |
Month | Mar |
Time | 18:56 |
Year | 2018 |
Two blog posts were tremendously helpful to me while I was working on this project. John Nguyen's college academic rankings bump chart provided the initial inspiration to visualize my listening history with a bump chart. I also found Jay Blanco’s project when researching for similar projects. I particularly like the crisp look of his lollipop charts. Both John and Jay's projects provided helpful code examples of charts I was interested in making for this project.
Package Information
Package | Resources |
---|---|
RShiny | Package Site |
R Googlesheets | RDocumentation, Github |
dplyr | RDocumentation, Package Site |
ggplot2 | RDocumentation, Package Site |
viridis | RDocumentation, Github |
ggrepel | RDocumentation, Github |
datetime | RDocumentation |
lubridate | RDocumentation, Package Site |
tidyr | RDocumentation, Package Site |
rlang | RDocumentation, Github |
here | RDocumentation, Github |
markdown | RDocumentation, Github |
cowplot | RDocumentation, Github |