R Programming for Beginners: Exploring R Vectors

R Programming    |    Beginner
  • 11 videos | 1h 28m 19s
  • Includes Assessment
  • Earns a Badge
Vectors are the easiest type of data structures in R. However, to use them successfully, it's important to appreciate their restrictions, recognize the types available, and identify their members - or components as they're officially called in R. This course shows you how to create and generate vectors using the c() and vector() functions, respectively. You'll perform vectorized operations on elements in vectors. Practice filtering and slicing vectors. And use the which(), any(), and all() functions on vectors. Furthermore, you'll perform naming and indexing operations on vectors and work with different length vectors using vector recycling. On completing this course, you'll have the knowledge and know-how to utilize vectors for their intended purpose.


  • Discover the key concepts covered in this course
    Generate vectors using the c() and vector() functions
    Create vectors and explore the nuances of vectors
    Perform indexing, slicing, and dicing operations with vectors
    Perform vectorized or element-wise operations
    Implement logical and relational operations on vectors
  • Create vectors containing data stored as name-value pairs
    Use recycling for operations with two different sized vectors
    Perform logical and filter operations on elements in vectors
    Filter vectors based on logical conditions
    Summarize the key concepts covered in this course


  • 2m 16s
    In this video, you’ll learn more about the course and your instructor. In this course, you’ll create and generate vectors using both the C and vector functions. You'll see how vectors cannot contain values of different types, and how vectors cannot be resized after creation. You'll then move on to vectorized operations, which help you work with elementwise operations on vectors. FREE ACCESS
  • 9m 11s
    In this video, you’ll learn more about creating basic R vectors. You’ll learn that in R everything is a compound type. Individual values are actually just one-element vectors. This demo is all about creating vectors. Onscreen you’ll see a variable called var.a. It’s been assigned the value 4. You’ll invoke the class function on this variable. FREE ACCESS
  • Locked
    3.  Understanding the Finer Points of R Vectors
    10m 40s
    In this video, you’ll watch a demo. In this demo, you’ll pick up where you left off at the end of the last one. You’ll continue experimenting with different ways to create vectors. Onscreen, you’ll see the numeric function with an integer 4 passed in. You’ll learn numeric is the name of the class which is used to hold double values. FREE ACCESS
  • Locked
    4.  Indexing into R Vectors
    12m 2s
    In this video, you’ll watch a demo. In this demo, you’ll learn indexing operations are important in every language. First, you’ll create a variable called students. This is going to be a vector containing strings. You’ll make use of the c function on the right-hand side of the arrow in order to initialize this vector of students. R supports square brackets as the indexing operator. FREE ACCESS
  • Locked
    5.  Performing Vectorized Operations in R
    8m 54s
    In this video, you’ll watch a demo. In this demo, you’ll learn about an important aspect of R, vectorized operations. It has two meanings. One, vectorized operations are those in which an operator or a function operates on each element of a vector without the need to write for a loop. The second use of this term is for functions that operate over a vector and summarize or reduce the results into a single value. FREE ACCESS
  • Locked
    6.  Implementing Relational Operations on R Vectors
    5m 52s
    In this video, you’ll watch a demo. In this demo, you’ll continue working with vectorized operations. You’ll move on to vectorized, logical, and relational operators. Onscreen, you’ll see three variables var.x, var.y, and var.z. You'll see each has four elements. The first is created by collecting TRUE, FALSE, TRUE, FALSE, in alternate order. var.y simply repeats TRUE four times and var.z repeats FALSE four times. You’ll perform a logical AND operation. FREE ACCESS
  • Locked
    7.  Creating R Vectors with Key-Value Pairs
    9m 44s
    In this video, you’ll watch a demo. In this demo, you’ll see elements in a vector in R can be assigned names, and those names can be used to access and identify individual elements. Here, you’ll see how this plays out in practice. You’ll begin by creating a new vector called fruit.quantities. This is done using the c function. FREE ACCESS
  • Locked
    8.  Recycling R Vectors in Vectorized Operations
    8m 11s
    In this video, you’ll watch a demo. In this demo, you’ll turn to a third case, which is a little trickier. You’ll see this is where there are operations between two vectors of differing lengths. This demo introduces an important concept called recycling. You’ll use vector.1. It’s used to hold the values 10, 20, 30, 40, 50, and 60. You've done this using the c function. Next, you’ll define a second vector called vector.2. FREE ACCESS
  • Locked
    9.  Filtering Data in R Vectors
    9m 46s
    In this video, you’ll watch a demo. In this demo, you’ll experiment with various other vector operations. You’ll start by creating a variable called vector.random. You've used the c function to collect various values and assign them to this vector. You’ll see there is no discernible pattern to the elements in this vector. Next, you’ll construct a logical vector by comparing vector.random to the value 0. FREE ACCESS
  • Locked
    10.  Using any(), all(), & which() Functions on R Vectors
    9m 51s
    In this video, you’ll watch a demo. In this demo, you’ll see how to work with additional R functions namely, which, any, all, and identity. Onscreen, you’ll see you’ve redefined vector.random so that it no longer has any NA values. Next, you’ll introduce the which function. You’ll see we've passed in a predicate. That predicate compares vector.random to 0 using the relational operator >=. FREE ACCESS
  • Locked
    11.  Course Summary
    1m 54s
    In this video, you’ll summarize what you’ve learned in the course. In this course, you’ve learned ways of creating vectors. You learned how to use the c function to collect values and create a vector out of them. You learned the size of a vector cannot be changed after it has been created. You also learned vectors can only contain values of the same data type. You discovered how to create vectors out of conditions. FREE ACCESS


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.