Chapter 2. Vectors

image with no caption

The fundamental data type in R is the vector. You saw a few examples in Chapter 1, and now you’ll learn the details. We’ll start by examining how vectors relate to some other data types in R. You’ll see that unlike in languages in the C family, individual numbers (scalars) do not have separate data types but instead are special cases of vectors. On the other hand, as in C family languages, matrices are special cases of vectors.

We’ll spend a considerable amount of time on the following topics:

Recycling

The automatic lengthening of vectors in certain settings

Filtering

The extraction of subsets of vectors

Vectorization

Where functions ...

Get The Art of R Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.