Nested for loop in r - erocor

Nested for loop in r - erocor