tutorial

A 10-post collection

Integrating blogdown and pkgdown

By Conor Neilson |  Sep 4, 2021  | blogdown, r, tutorial
Make your pkgdown websites be part of your blogdown website. Context I have websites set up using both blogdown and pkgdown. The reason for using both is they solve very different problems. For instance I have My main personal website, built with blogdown, and hosted by Netlify Individual websites for R packages, built with pkgdown, and hosted on Github Pages This is a case where it’s appropriate to be using both.
Continue Reading...

Scheduling scrobbler (properly this time)

By Conor Neilson |  Aug 14, 2021  | r, tutorial
I finally learn how Github Secrets work! My previous mistake In a previous post, I showed an example of how to use Github Actions to schedule scrobbler to run automatically and save the downloaded data into your github repo. This was a bit janky because you had to hardcode your API details into the script, and therefore it had to be a private repo in order to avoid leaking your details.
Continue Reading...

Scheduling scrobbler to run automatically

By R package build |  May 20, 2021  | r, tutorial
Using github to automatically schedule, run, and store dataframes of your scrobbles in a repository. One of the biggest issues you can run into when trying to analyse your scrobble data is waiting for it all to download when running download_scrobbles(). While the addition of update_scrobbles() partially helps this, it still relies on you having a relatively recent source of scrobbles available in a dataset. The idea behind this post is to setup a github repo where you can store scrobbled datasets.
Continue Reading...

Announcing 'words'; an R package containing scrabble allowed english words

By R package build |  May 16, 2021  | package-development, r, tutorial
I’m thrilled to announce the release of my new package words. words is an extremely simple package, but I’m excited to use it for my future projects. Recently I’ve been playing around with some word based puzzles in R. One of the examples of this is wordbuilder, which finds all valid words of from a given list of 5 letters. In an example like this, one of the challenges is finding a list of valid english words.
Continue Reading...

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...

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...