Let's briefly summarize what we learned in this part of the course.
R allows us to create vectors, which are data structures representing sequences of elements of the same data type. They can store numbers (numerical vectors), text values (character vectors), or logical
FALSE values (logical vectors).
We define vectors with either the
function or the
Addition, subtraction, multiplication, and division operations are all defined for vectors and occur in a memberwise fashion. They can occur between two vectors or between a vector and a numerical value.
You can access the elements of a vector using the bracket
 operator. You can access the "i"th element using
You can also retrieve several elements at once by listing the index positions:
A third way to access vector elements is to use conditional operators inside the brackets:
ages[ages > 40]
There are many functions that we can use to analyze numerical data, such as
quantile(). Alternatively, we can use the
summary() function to display all this information at once:
Finally, you can use all functions on vector subsets:
summary(ages[ages >= 18])