My knowledge of history is patchy at best. I've read
Judt on the post-war Europe, digested
several Preston books on the
Spanish Civil War, laid my hands on the two-volume biography of Adolf Hitler
(and, by extension, the Second World War) by
Kershaw and a bit more. Canada,
were I am living now, remains more or less a mystery (save for a lightning-fast
history lesson I got thanks to my outstanding French teacher), though I plan on
fixing that as soon as I have some free time. The rest of the planet is pretty
much a black hole, except for isolated details. I find myself in the same
situation as that hypothetical Martian that arrives at Earth on a cold night
with no clue what is going on and needs to get up to speed fast. What would I do
if I were in his / her / its place?

Read the data, inspect it, and clean it. This will be pretty easy in this
case, as the files are already in good shape. Also, as the vote outcome can be
encoded in different ways (see the Codebook file for an extended
explanation), I will re-encode it to simplify: 1 for yes, 0 for any kind of
abstention or non-vote, -1 for no.

With this, I can proceed and compute the cosine
similarity between each pair
of countries for each year. The output of this mathematical function will be 1
if these countries voted always in the same way, and 0 if they were completely
opposed. This is widely used in the construction of recommender
systems and yields a pretty
good indicator of how similar a given country is to any other. We can also
explore temporal changes, but more on this later.

If cos is the cosine similarity between any pair of countries, 1 - cos is
the dissimilarity, which I will treat as a distance. This distance matrix
can be used as the input for
t-SNE,
which will output an x, y coordinate pair per country to generate cluster
maps: the idea is that we can visualize a map of the World in which the
geographical positioning is provided by political outputs. This will be
something like this:

That loop above was me being overoptimistic about the perplexity parameter,
assuming that it's going to work just the same for all yearly datasets. Anyone
who has worked with t-SNE will tell you that this will hardly be the case. As a
consequence, when I show clusters later on in this post, please have in mind
that each one of them will surely have been produced with slightly different
values. For a very comprehensive introduction to this topic, please read this
excellent piece.

Also, as I am interested in seeing how different countries have modified their
relations with time, I will have a function to extract precisely that so it
can be easily plotted.

Ok, we are done. Let's take a look at the world in 1948, which is a good example
of the final result.

Seems to make sense. There is one very clear cluster of mostly South American
countries, a "Western" bloc, a group of mostly arab countries and the Communist
bloc. x and y have no special meaning in this plot, so they can't be
directly read as social or economic axes.

Also, have in mind that the dataset is trying to keep a certain consistency with
country names across time. So, Russia is Russia in 2013 and in 1948.

But 1948 had very few countries as UN members. We can advance a bit more, to
1966, for instance. This is what it looks like:

Clusters are not so clear (there's many more datapoints now), but look close to
the center of the image: Libya, Tunisia, Syria, Sri Lanka, Indonesia, India,
Morocco... it's a pretty good approximation for a cluster of countries that
formed the Non-Aligned
Movement (thanks, Antonia,
for pointing this out). Then we have the other two typical blocs and some
smaller clusters that are more difficult to make sense of.

And, just to finish this part, the world in 2013, which I will not comment on:

In any case, these are static images, a flash of what the UN voting record is
telling us for each particular year. But it can be more informative to plot the
agreement (in our case, the similarity) between any given pair of countries
across time. We can do that easily with the utility function I presented above.
For example:

I have added cosined_data.Rda to the repository so you can directly load it
and use this utility function to plot whatever you like.

As usual with these projects, there are many caveats worth mentioning. Mainly,
this is a very (very!) rough simplification. The votes have been encoded in a
way that is probably losing useful information and, more important, the UN
General Assembly votes will not include all the subtleties and nuances of
international politics. Also, one must take into account that I am computing the
similarity using the complete voting records for a year, but a clustering done
after separating the votes in different sub-issues (for instance, environmental,
of Palestine) will probably yield more fine-tuned results. It's good for having
fun, but one should be careful when interpreting the results.

In any case, if you play around with this dataset and find something
interesting, drop me a line!.