R: For-loop