how to use the for loop function in r code example Example: r for loop for (val in sequence) { statement }