Using R Programming Structures: Leveraging R with Control Flow & Looping
R Programming
| Intermediate
- 10 videos | 1h 12m 28s
- Includes Assessment
- Earns a Badge
Becoming adept at using R will form a valuable part of your statistical data analysis programming language toolkit. Achieving this involves learning how to utilize the functional programming structures of R. This course shows how to use conditional constructs, statements, looping, and functions effectively in R. You'll practice using if, else, and the ifelse functions and the switch construct. You'll work with for and while loops. Recognize the next and break statements in R. And examine the repeat loop, which does not have a condition at all and must be used with a break statement. You'll then move on to advanced looping using the vapply(), lapply(), and sapply() functions in R. By the end of this course, you'll be able to use f R for control flow and looping.
WHAT YOU WILL LEARN
-
Discover the key concepts covered in this courseUse if statements to execute a set of operations only if a condition is satisfiedMake use of the ifelse() function and the switch statement to execute conditional operationsRecall how for loops can be used to iterate over a vector of valuesIterate over recursive lists and two-dimensional matrices using for loops
-
Implement if statements and nested for loops within outer for loopsUse while loops to perform an operation while a condition is trueUse repeat loops to repeat an operation until a break statement is reachedUse the sapply(), vapply(), and tapply() functions to apply functions to elements in vectorsSummarize the key concepts covered in this course
IN THIS COURSE
-
2m 35sIn this video, you’ll learn more about your instructor and this course. In this course, you’ll learn about the conditional constructs if and else. You'll also learn about the ifelse() function, as well as a syntactic quirk in which the closing brace of an if-block and the else keyword need to be on the same line. You'll also learn the switch statement, which can be used to work with multiple different cases. FREE ACCESS
-
10m 29sIn this video, you’ll watch a demo. This demo is about ifelse conditionals in R. Ifelse conditionals are examples of ways to change the flow of control in a program. As you’ll learn, these are different from loops such as while and for loops which are iterative control structures. FREE ACCESS
-
11m 48sIn this video, you’ll watch a demo. In this demo, you’ll start by looking at something known as the vectorized ifelse function. To see what this means, you’ll first create a simple variable called logical.vector. Here you’ll make use of the c function in order to collect various TRUE and FALSE values. FREE ACCESS
-
8m 33sIn this video, you’ll watch a demo. In this demo, you’ll get started with for loops in R. You’ll learn for loops are the most important interactive control structure in any programming language. Even though functional programming has reduced the importance of for loops, it's still critical to know how to iterate over the content of different data structures such as matrices, lists, and arrays. FREE ACCESS
-
6m 59sIn this video, you’ll watch a demo. In this demo, you’ll pick up where you left off in the last demo. There, you iterated your first logical vector. Now, you’ll learn the idea of iterating over different R data structures. Onscreen now, you’ll see a list. Remember the differences between a list and a vector. A list can contain elements of different types. It can also contain sub-lists as well as vectors as elements. FREE ACCESS
-
7m 38sIn this video, you’ll watch a demo. In this demo, you’ll turn your attention from iterating over different types of data structures in R to the keywords break and next. Onscreen you’ll see a for loop. Within the body of the for loop, you’ll use the break keyword. When the break keyword is encountered during the code execution, the for loop will terminate and control will come out of the for loop entirely. FREE ACCESS
-
7m 53sIn this video, you’ll watch a demo. In this demo, you’ll turn your attention from for loops to while loops. You’ll learn there are a couple of control structures that aren't used all that often, while loops are one and repeat blocks are another. You’ll look at both of these iterative control structures in this demo. Onscreen you’ll see your first while loop. FREE ACCESS
-
4m 37sIn this video, you’ll watch a demo. In this demo, you’ll use repeat loops in R. You’ll learn you need to make sure your while loop terminates at the right point, not too early and not too late. It's easy to get into an infinite while loop. To mitigate the complications surrounding while loops R has another control structure called the repeat block. It’s a simple control structure because it doesn't have a condition. FREE ACCESS
-
10m 15sIn this video, you’ll watch a demo. In this demo, you’ll learn advanced looping constructs, specifically the functions lapply, vapply and sapply. You’ll understand why these constructs are required and helpful. Onscreen, you’ll see the list of lists you’ve already created. You attempted to use a for loop to iterate over the elements of that list. FREE ACCESS
-
1m 43sIn this video, you’ll summarize what you’ve learned in the course. You’ve learned the conditional constructs using if and else. You also learned about the ifelse function, and used the syntactic quirk in which the closing brace of an if block and the else keyword need to be on the same line in recent versions of R. You also learned the switch statement, which can be used to work with multiple different cases. FREE ACCESS
EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE
Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.
Digital badges are yours to keep, forever.