Using R Programming Structures: Leveraging R with Control Flow & Looping

R Programming    |    Intermediate
  • 10 videos | 1h 12m 28s
  • Includes Assessment
  • Earns a Badge
Rating 4.5 of 10 users Rating 4.5 of 10 users (10)
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 course
    Use if statements to execute a set of operations only if a condition is satisfied
    Make use of the ifelse() function and the switch statement to execute conditional operations
    Recall how for loops can be used to iterate over a vector of values
    Iterate over recursive lists and two-dimensional matrices using for loops
  • Implement if statements and nested for loops within outer for loops
    Use while loops to perform an operation while a condition is true
    Use repeat loops to repeat an operation until a break statement is reached
    Use the sapply(), vapply(), and tapply() functions to apply functions to elements in vectors
    Summarize the key concepts covered in this course

IN THIS COURSE

  • 2m 35s
    In 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 29s
    In 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
  • Locked
    3.  Using ifelse() and the Switch Statement in R
    11m 48s
    In 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
  • Locked
    4.  Iterating over Data with For Loops in R
    8m 33s
    In 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
  • Locked
    5.  Iterating over R Lists and Matrices with For Loops
    6m 59s
    In 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
  • Locked
    6.  Using Nested For Loops in R
    7m 38s
    In 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
  • Locked
    7.  Using While Loops in R
    7m 53s
    In 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
  • Locked
    8.  Using Repeat Loops in R
    4m 37s
    In 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
  • Locked
    9.  Performing Advanced Looping in R
    10m 15s
    In 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
  • Locked
    10.  Course Summary
    1m 43s
    In 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.

YOU MIGHT ALSO LIKE

Rating 4.5 of 38 users Rating 4.5 of 38 users (38)
Rating 4.5 of 26 users Rating 4.5 of 26 users (26)

PEOPLE WHO VIEWED THIS ALSO VIEWED THESE

Rating 4.4 of 176 users Rating 4.4 of 176 users (176)
Rating 4.6 of 415 users Rating 4.6 of 415 users (415)
Rating 4.6 of 9 users Rating 4.6 of 9 users (9)