Recreational programming

Screenshot of problem 1, Advent of Code 2021

I think programming, aka coding, is a fun activity. We are solving a problem subject to a set of constraints that can be time, memory, quantity of code, language, etc. Besides being a part of my work, coding is also a good distraction when doing it for the sake of it. In this type of… Continue reading Recreational programming

Fixing Rcpp warning in Mac OS

Riccarton market, Christchurch

In Mac OS I was getting an annoying warning when compiling Cpp code via Rcpp in R:

Adding a file called Makevars in ~/.R defining FLIBS to the actual location of gfortran in my machine fixed the problem. In my case, Makevars only contains the following line:

That's it.

Calculating parliament seats allocation and quotients

Gratuitous picture: tree on stilts (Photo: Luis, click to enlarge).

I was having a conversation about dropping the minimum threshold (currently 5% of the vote) for political parties to get representation in Parliament. The obvious question is how would seat allocation change, which of course involved a calculation. There is a calculator in the Electoral Commission website, but trying to understand how things work (and… Continue reading Calculating parliament seats allocation and quotients

Collecting results of the New Zealand General Elections

New Zealand Electoral Commission results website. It held really well in election night.

I was reading an article about the results of our latest elections where I was having a look at the spatial pattern for votes in my city. I was wondering how would I go over obtaining the data for something like that and went to the Electoral Commission, which has this neat page with links… Continue reading Collecting results of the New Zealand General Elections