Why are loops slow in R compared to apply?
I have heard that loops are slow in R and that I should try to do things in a vectorised manner instead.
But, why are loops slow and apply is fast? apply calls several sub-functions -- that doesn't seem fast.