Category Archives: Computery

Making R go faster

If you need more than your for loops speeded up in R, you might want to see Noam Ross’s FasteR! HigheR! StrongeR! – A Guide to Speeding Up R Code for Busy People. It’s super practical and easy to understand.

Slow for loops in R

When I wrote my first for loop ever (in R), it was a pretty exciting moment in my life. There was definitely some happy dancing. Some of my for loops were really fast, but others that seemed pretty similar to my eyes took a really long time. I had a hard time figuring out why. If you are in the same boat, I recommend reading this section of Thomas Girke‘s Programming in R manual. It’s much faster than the “trial-and-error with occasional advice from other R users” approach I took.

Error installing R package e1071

I wanted to play around with the Floyd-Warshall algorithm today. Lucky for me, it’s included as part of the e1071 package. When I tried to install it – from the CRAN repository and from source – I got

ERROR: 'configure' exists but is not executable

The solution (from a recent post on Jonathan Callahan’s blog) is to “set the TMPDIR environment variable which R will use as the compilation directory.” For me, this meant

$ mkdir ~/tmp
$ export TMPDIR=~/tmp

Fixing git mistakes

I made a git repository in a main folder for a certain project to keep track of the entire project. But actually it was only keeping track of stuff in that main folder and a few of the subfolders. Other subfolders had separate git repos! I needed to get everything in one repo without screwing up any of my work. I will not go into the silly details of how this terrible situation arose, but if you happen to find yourself in this position, MiniQuark‘s answer to this question may save you some time.