When I teach R, I always caution the audiences about the quirks of R programming. It is very typical for someone with a background in Java or Python to write code in R that will take forever to execute (like I used to do, and sometimes still do). I warn the students about loops and encourage vectorized operations. Unfortunately, writing faster code in R is often a more involved affair. What I offer are just some easy fixes to most common issues.

Thinking of those students that may be reading my blog, I want to share a resource that I think would be helpful. If you have reached the point in your R endeavour where you feel the need to write better code take a look at Hadley Wickham’s Advanced R. Information contained in the web site is also available as a dead tree book.