INTRODUCTION TO PROGRAMMING IN R > MISSION 2 > VECTORS IN R

Working With Vectors

In the Introduction to Programming In R lesson, you learned that vectors are data structures in R that can hold multiple values. In this lesson, you will build upon that foundation by learning how to index, manipulate, and perform calculations on vectors. 

In addition, you will get a more in-depth look at manipulating vectors for data analysis by working with a subset of values in a vector, assigning names to elements of a vector, and using comparison operators to answer questions about data stored in vectors.

After completing this lesson about vectors, you will be able to explain vector recycling, a super important concept in R, and identify the three different data types in R: numeric, character, and logical.

After you finish this lesson, you will be well-equipped to start building simple programs in R; what you build is limited by the depth of your imagination. If you have trouble coming up with ideas, you can practice by following this tutorial to build a simple calculator and maybe some additional ideas for programs will come to mind.

Objectives

  • Learn about vectors, foundational data structures in R.
  • Index vectors to extract specific elements.
  • Apply functions to vectors to perform calculations.

Mission Outline

1. Indexing Vectors by Position
2. Numeric and Character Data Types
3. Naming Elements of a Vector
4. Indexing Vectors Using Names
5. Comparing Values And Logical Data Types
6. Comparing Single Values Against Vectors
7. Logical Indexing
8. Performing Arithmetic with Vectors
9. Vector Recycling
10. Appending Elements To A Vector
11. Next Steps
12. Takeaways

intro-to-r

Course Info:

Beginner

The median completion time for this course is 6.2 hours. View Details

This course is free. This course includes five missions and one installation tutorial. This course is the first course in the Data Analyst in R path.

START LEARNING FREE

Take a Look Inside