A 17-post collection

Auto-authentication with scrobbler

By R package build |  Jan 31, 2021  | r, tutorial, package-development
Authenticate automatically using environment variables I’m pleased to announce a new version of scrobbler which introduces a slightly new way to authenticate download_scrobbles and update_scrobbles calls. This change is released on CRAN, so you can get the update by running install.packages("scrobbler") New authentication In previous versions of scrobbler, whenever you wanted to download scrobbles you had to pass in your username and API key. library(scrobbler) my_data <- download_scrobbles(username = "your_username", api_key = "your_api_key") This quickly gets tiring (particularly with the API key), so I’m pleased to announce there is now a better way.
Continue Reading...

Tracking your music history with scrobbler (part 2)

By Conor Neilson |  Jan 15, 2021  | r, tutorial
In part 2 of this series, we’ll be looking at how to actually start using scrobbler to download your music history. As a quick recap from part 1, scrobbling is a service offered by Last.fm, where any music you listen to on other platforms (i.e., Spotify) is recorded and stored by Last.fm, along with a timestamp and associated metadata. scrobbler is intended as an interface to that database, so you can download and explore your music history with the full freedom of R.
Continue Reading...

Finding my most played song in a single day with scrobbler

By Conor Neilson |  Dec 17, 2020  | r, tutorial
Ever since publishing my first post about the development of scrobbler I’ve been meaning to spend much more time writing and showcasing some of the analyses I wanted to do with it. As with many things, life gets in the way, but this is my effort to show something small and simple. My idea for this post came from Spotify’s ‘2020 Wrapped’ video they make for you showing trends of your listening over the previous year.
Continue Reading...

Tracking your music history with scrobbler (Part 1)

By Conor Neilson |  May 11, 2020  | r, tutorial
Note: This is the first of a 2 part post about scrobbler. This first one will deal with what exactly scrobbles are and how to get started, while part 2 will focus on actually using the scrobbler R package. Like many people, I’ve always loved music. While my skills at playing music are embarrassingly non-existent, I basically listen to music all day every day. Therefore, it was only inevitable that I would eventually start to muse on how I could apply my love of data to my love of music…
Continue Reading...

Resetting fileInput in Shiny

By Conor Neilson |  Apr 5, 2020  | package-development, r, tutorial
While working on my (currently WIP) package nebula, I ran into an issue with resetting the fileInput component in Shiny. In short, nebula allows you to upload a photo of an otolith (fish ear bone), and mark the positions of the growth rings (like in a tree trunk). Once you’ve finished, you can download the positions as a csv file. The issue I ran into, is once you’ve finished marking your photo, if you want to then start a new photo, you need some way of resetting the fileInput, and removing the current photo.
Continue Reading...

A silly typing mistake

By Conor Neilson |  Mar 14, 2020  | r, package-development
Recently I was working on my WIP package ‘verhoeff’, for calculating check digits based on the Verhoeff algorithim. I was at the stage where most of the basic code was written, so I was starting to test simple examples. I was testing an early implementation which I thought would work. I used the code calculate_digit(prepare_number(1), dat$d5, dat$d5_p, dat$inv_v) In this code, prepare_number simply does some checks to see if the number is valid, and converts it to a numeric vector.
Continue Reading...

Calculating the number of gifts in the ’12 Days of Christmas'

By Conor Neilson |  Mar 7, 2020  | r, tutorial
Over the holiday period my partner was talking about a question she was posed at a work quiz, which was “How many gifts in total are given in the song”The 12 Days of Christmas". I thought this was a great opportunity to showcase some of the basic skills that are useful to master in R, namely functions and *apply. First, we need to consider how to calculate the number of presents gifted in any given day.
Continue Reading...