For loop in R Syntax
for (var in vector) { statement(s) }
Here, var takes on each value of the vector during the loop. In each iteration, the statements are evaluated.
For loop in R
For loop in R Programming Language is useful to iterate over the elements of a list, data frame, vector, matrix, or any other object. It means the for loop can be used to execute a group of statements repeatedly depending upon the number of elements in the object. It is an entry-controlled loop, in this loop, the test condition is tested first, then the body of the loop is executed, the loop body would not be executed if the test condition is false.