In R, loops are often not the most efficient way to do repetitive calculations. Rather than doing the calculations for each value of a variable it is much more efficient to organize the values of…
In this video we introduce the repeat and while loops. There are small differences in the syntax of the three types of loops in R, which may make one form more convenient than another in any given…
In this video we illustrate how to use the OUTPUT statement within a DO loop to generate data from scratch. This technique can be used for a variety of purposes including simulating data from a known…