Articles by David Selby

Indexing from zero in R

December 6, 2021 | David Selby

Everybody knows that R is an inferior programming language, because vector indices start from 1, whereas in real programming languages like C and Python, array indexing begins from 0. Sometimes this can be quite annoying if a problem—be it a math... [Read more...]

Advent of Code 2021

December 1, 2021 | David Selby

It’s that time of year again. And not just for Secret Santa—it’s time for the Advent of Code, a series of programming puzzles in the lead-up to Christmas. I’m doing the 2021 challenge in R—in the form of an open-source R package, to demonstrate a test-driven ... [Read more...]

The unequalled joy of non-equi joins

February 13, 2021 | David Selby

A common task in data analysis is to merge or join two tables according to shared keys or values. The operation is perhaps most commonly associated with relational databases and structured query language (SQL) but it’s just as useful in R with data frames. Most joins are equi-joins, matching ... [Read more...]

Advent of Code 2020

December 6, 2020 | David Selby

Advent of Code is a series of programming puzzles you can tackle to hone your coding skills each day in the run-up to Christmas. This year I am attempting it using R, which can make some challenges easier or harder depending on whether they are more... [Read more...]

Advent of Code 2020

December 6, 2020 | David Selby

Advent of Code is a series of programming puzzles you can tackle to hone your coding skills each day in the run-up to Christmas. This year I am attempting it using R, which can make some challenges easier or harder depending on whether they are more... [Read more...]

R code golf: the identity matrix

March 27, 2019 | David Selby

How many different ways are there to create an identity matrix in R? This was an interesting little challenge set by Guillaume Nicoulaud on Twitter. Find as many way you can to create the identity matrix with #rstats. pic.twitter.com/HlhIM6mSrx— Guillaume Nicoulaud (@ordrespontane) February 3, 2018 In code golf, ... [Read more...]

R code golf: the identity matrix

March 27, 2019 | David Selby

How many different ways are there to create an identity matrix in R? This was an interesting little challenge set by Guillaume Nicoulaud on Twitter. Find as many way you can to create the identity matrix with #rstats. pic.twitter.com/HlhIM6mSrx— Guillaume Nicoulaud (@ordrespontane) February 3, 2018 In code golf, ... [Read more...]

Exploring influence in networks

March 7, 2018 | David Selby

I have just published an interactive graphic showing the effect of ranking scientific communities with pairwise comparison models. The visualisation is an interactive version of my (award-winning) useR!2017 poster, Ranking influential communities in networks. You can see how academic journals have been grouped into communities based on their citation behaviour, ... [Read more...]

Building a neural network from scratch in R

January 9, 2018 | David Selby

Neural networks can seem like a bit of a black box. But in some ways, a neural network is little more than several logistic regression models chained together. In this post I will show you how to derive a neural network from scratch with just a few lines in R. ... [Read more...]

Using R on Android

December 29, 2017 | David Selby

I just discovered a way to get R running on my smartphone, with full support for packages, graphics and R Markdown, and no need to connect to an external server. This is really handy for quickly checking R code, trying out ideas and writing blog posts on the go. It ...
[Read more...]

useR! poster: ranking influential communities

June 29, 2017 | David Selby

Next week I will be presenting a poster at the useR!2017 conference in Brussels. My topic is Ranking influential communities in networks. Using a large dataset of citations from the Web of Science, we grouped academic journals into communities based on their citation behaviour. These communities closely correspond to recognisable ...
[Read more...]

Chernoff faces in ggplot2

June 25, 2017 | David Selby

I am pleased to introduce my first R package for general consumption, ggChernoff. Inspiration stems from Leland Wilkinson’s book, The Grammar of Graphics, whose principles were later implemented as the layered grammar of graphics in Hadley Wickham’...
[Read more...]

Publishing from blogdown to GitHub with Travis

June 22, 2017 | David Selby

Yihui Xie’s new blogdown package is a brilliantly elegant and simple tool for creating R-themed blogs and web sites. Starting your own blog is as simple as one line of R code: blogdown::new_site() By default, blogdown uses Hugo, a static web site generator written in Google’s ...
[Read more...]

Pretty errors, warnings and messages in R Markdown

June 18, 2017 | David Selby

When knitting an R Markdown document to HTML output, R chunks can produce warnings, errors or messages. Normally these messages look like any other console output: Pretty ugly, and usually something I find myself trying to hide at the earliest opportunity. But if you’re using R Markdown’s default ...
[Read more...]

Deploying an R Markdown Jekyll site to GitHub Pages

June 16, 2017 | David Selby

GitHub Pages’ built-in Jekyll support makes it very easy for techie types to deploy static web sites. Simply push your plain text Markdown content to a repository and the server-side Jekyll engine will render it for the web. Markdown is good, but R Markdown is even better, assuming we ever ... [Read more...]

Secret Santa in R

December 7, 2016 | David Selby

Our office just exchanged presents for Secret Santa, a tradition where each person is randomly assigned someone else to give an anonyous gift. One of the challenges of Secret Santa is keeping the pairs of gift-givers and receivers both random and secret. How can you do this while also taking ...
[Read more...]

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)