Vector
A vector is a group of primitive values of the same type. It can be a group of numbers, true/false values, texts, and values of some other type. It is one of the building blocks of all R objects.
There are several types of vectors in R. They are distinct from each other in the type of elements they store. In the following sections, we will see the most commonly used types of vectors including numeric vectors, logical vectors, and character vectors.
Numeric vector
A numeric vector is a vector of numeric values. A scalar number is the simplest numeric vector. An example is shown as follows:
1.5 ## [1] 1.5
A numeric vector is the most frequently used data type and is the foundation of nearly all kinds of data analysis. In other popular programming languages, there are some scalar types such as integer, double, and string, and these scalar types are the building blocks of the container types such as vectors. In R, however, there is no formal definition of scalar types. A scalar number...