Introduction to R, Part IV Loops and Functions
[SQUEAKING] [RUSTLING] [CLICKING] HELENA VALLICROSA: Now is where things get interesting and where we're going to use the power of the computer to make our lives easier and not prevent us from doing mechanical stuff over and over. So we're just going to set some commands, and the computer is going to run them for us without us being there repeating the stuff. So there are two different types of loops. We have for loops and the while loops. The main difference between them is that for loops are static, so they are going to be repeated for the amount of iterations that we set at the beginning. But then we have the while loops, which are the ones that are going to stop once a command is reached. So whenever there's a constant that has overpassed or whatever is a different that has been fulfilled. You'll see that further when I'll explain them a little bit more in detail. So let's just go with for loop at the beginning. I'm just going to create a v...