Vectors in R

Learning to work with data structures is critical for programming in R. Data structures are essential concepts in programming because efficient data storage and operartions rely on them.

In this first lesson of our interactive Data Structures in R course, you will continue adding to your R programming skills as you learn about vectorization, and how to work with vectors in R.

A vector is a data structure that represents a set of values of the same type, allowing for performing group operations. This can make certain kinds of operations and calculations much, much faster than executing them one-by-one. In this lesson, you'll look at how to create, index, modify, add to, remove from, and perform operations with vectors.

After you finish this lesson, you will be comfortable working with vectors, and you'll have a solid understanding of why you might want to use vectors in your data analysis work. 


  • Learn about vectors and why they're useful.
  • Create, modify, and perform operations with vectors.
  • Learn about vector recycling.

Mission Outline

  1. Introduction to Data Structure: Generating Vectors
  2. Creating a Vector Using Known Values
  3. Indexing Vectors by Position
  4. Indexing Vectors Using Logicals
  5. Modifying Elements in a Vector
  6. Appending Elements to a Vector
  7. Removing Elements from a Vector
  8. Performing Operations with Vectors
  9. Vector Recycling
  10. Vectors Using Names
  11. Next Steps

Course Info:


This course requires a Basic subscription and includes four missions and one guided project.  It is the second course in the Data Analyst in R learning path.


Take a Look Inside