OneBite.Dev - Coding blog in a bite size

use a basic loop in R

Code snippet on how to use a basic loop in R

  for (i in 1:10) {
    print(i)
  }

This code is an example of a basic loop in R. This loop is designed to print the numbers 1 through 10. The loop consists of a counter (i) set to 1 and an upper limit of 10. This means that the loop will start at the number 1, and will run 10 times. On each iteration, the loop will print the value of the counter (i). After the 10th iteration, the loop will stop. So this code will result in the numbers 1 through 10 being printed.

r