The structure of the while
loop in R is simple; it starts with a desired result that the user wants to see from the experiment. As the condition is entered in the beginning, the body of the loop will start iteration and go on as long the condition is being met. The skeleton structure of a while
loop consists of a constraint condition to start with; here is an example:
x <- 10 while (x < 60) { print(x) x = x+10 }
If we compare different types of loops in the R programming language, for
loop and while
loop are very frequently used; repeat
loop is not used that frequently because of the time it takes to complete the run. If we compare the loops with the apply group of functions, the latter set of functions is quite effective in handling different tasks in R. Let's look at the apply group of functions.
18.217.150.123