Cognitive ability and political preferences in Denmark: knitr edition

http://rpubs.com/EmilOWK/208757 Analysis of the data collected so far, presented side by side with R code. It will be expanded into a proper paper and submitted to OQSPS soonish. Soonish here meaning when Noah gets around to do it! Due to the surprising results, we should probably do a follow-up replication using new subjects. These results…

Continue Reading

Python: Removing empty lists from mixed nested lists

Suppose you have some function that returns possibly nested lists with empty lists inside. Worse, they may have lists with lists with an empty list inside. And suppose you want to get rid of all the empty lists, including those that just have other lists with empty lists inside. Like this: a = [1, [2,…

Continue Reading

Installing the gsl package for R on Linux Mint 18

Today I was trying to install the MBESS package. One of its dependencies is the gsl package. However, trying to install that package gave the following error: cp: cannot stat ‘*.gcno’: No such file or directory Makevars:45: recipe for target ‘save-gcno’ failed make: [save-gcno] Error 1 (ignored) Googling it gave 0 results, which is a…

Continue Reading

Linux Mint stuck in fallback mode?

I have the problem that many people have: Virtualbox refuses to increase the so-called dynamic disk. The result is that at some point one runs out of space and one can be unlucky about the timing! I was in the middle of installing Rodeo (this is a Python clone of RStudio) and its dependencies when…

Continue Reading

Collapsible list in HTML/CSS/JS

I am working on a website where we need to present a large amount of information in a hierarchical list. The list will have several thousand elements so it seems best not to present it all immediately. Instead, we want to use a collapsible list so that users can expand the elements they are interested…

Continue Reading

Getting Facebook to show preview images

I noticed that Facebook wasn’t showing any preview images for a website I maintain (http://teknologipartiet.dk/, my pet grey tribe political party/think tank). It turns out that Facebook wants a metatag to know which image to use: og:image. And how does one get this? Fortunately, there are some simple WordPress plugins to handle this issue. After…

Continue Reading

Scraping IMDB user ratings

There are some sites that have scraped the average movie ratings at various sites such as IMDB, Rotten Tomatos and Allmovies. Here is one particularly good (and still online) job. Still, this is all aggregate data. Perhaps we are more interesting in how people rate movies. One does have the option to make one’s profile…

Continue Reading