To show a proper example of how to use this package I have created a dummy
Last.fm user called “RScrobblerUser”. This vignette will walk through how you would use
scrobbler to fetch and read the dummy users tracks.
First we will assume there is a python 3 installation on your computer, and that it is the default version used by R. If you are not sure, please read the other vignette.
The first step is to install the scrobbling script into your working directory.
library(scrobbler) # specify version 3 for use with python 3.x install_scrobble_script(version = "3")
This copies the script into your working directory. From here we use
fetch_tracks and specify the username and output file. For this example, we will use our dummy user: “RScrobblerUser”
fetch_tracks(username = "RScrobblerUser", out_file = "scrobbles.txt", start_page = "1")
This downloads a .txt file called “scrobbles.txt”. We can use the function
read_scrobbles to bring it into R while ensuring correct formatting.
read_scrobbles is just a thin wrapper around
read_delim, so you can pass any additional arguments that you would to
my_tracks <- read_scrobbles("scrobbles.txt")
read_scrobbles displays the time column in UNIX format. To parse this into a more human readable format, you can use
my_tracks$Date <- convert(my_tracks$Date, to = "Time")
Now you are free to analyse and explore your own music trends!