MISSION 333

# Working With Vectors

In this lesson, you will build what you've learned in this Introduction to R course by learning how to index, manipulate, and perform calculations on vectors in R.

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.

#### Lesson 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