Читать книгу The Big R-Book - Philippe J. S. De Brouwer - Страница 135
4.5.2.1 The For Loop
Оглавлениеfor
loop – for
As in most programming languages, there is a “for-loop” that repeats a certain block of code a given number of times. Interestingly, the counter does not have to follow a pre-defined increment, the counter will rather follow the values supplied in a vector. R's for-loop is an important tool to add to your toolbox.
The for-loop is useful to repeat a block of code a certain number of times. R will iterate a given variable through elements of a vector.