Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
What are vectors?
1. Vectors
Vector operations
Indexing and filtering


Welcome to Part 2 of Introduction to R. In this part you'll learn about the most basic R type: the vector. A vector is a data structure that allows you to work on a collection (sequence) of elements.

We'll work with data from a small company called Versico. This data contains information about its business operations and employees. If the information about Versico employee ages is stored in a vector called ages, we can display that vector. R responds by printing the values stored in the variable:

[1] 28 29 43 39 31 29 28 34 31 24 22 25

There are 12 numbers in this variable. We call the entries of a vector elements. This vector contains numbers, so it is called a numeric vector.


We've stored the salaries of Versico employees in a vector named salaries. Display the values that are stored in this vector. Observe how many salaries appear in the output.

Stuck? Here's a hint!

Type the salaries in the Code Editor and click Run and check code.