> Would like some tips on how to avoid loops as I know they are slow in R They are not slow. They are slower than vectorised equivalents, but not slower than apply and friends. Hadley -- http://had.co.nz/