It now includes getArtistsAlbums which takes the output from a getArtists search and finds the albums by that artist and outputs a data.frame. This can be followed up by a getAlbumsTracks which will find all the tracks from those albums and create a data.frame. Finally I’ve added visDiscography. This uses both those functions along with the get artist function to create an interactive visualisation of an artists discography.
The biggest challenge here was creating the json file to insert into the d3. It requires a nested json, so I had to write a function that works back through the data.frame nesting at each level. The function can be found in this gist.
The final output shows all an artists albums and the tracks on those albums. You can click on a track to listen to a short sample from the track. You may need to adjust the height in the html file if you have lots/not many albums and tracks.
Here’s the code for Shuggie Otis:
out<-visDiscography(artist="Shuggie Otis", output_file="Shuggie Disco.html")
Here's the output and have a listen to some Shuggie: