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.