A data structure is a particular way of organizing data in a computer so that it can be used effectively. A vector is the basic data structure in R, or we can say vectors are the most basic R data objects. It is homogenous, which means that it only contains elements of the same data type. Data types can be numeric, integer, character, complex, or logical. Vectors are created by using the c() function.
There are six types of atomic vectors such as logical, integer, character, double, and raw. “A vector is a collection of elements which is most commonly of mode character, integer, logical or numeric”
A vector can be one of the following two types:
- Atomic vector:
# R program to illustrate Vector # Vectors(ordered collection of same data type) X = c(1, 3, 5, 7, 8) # Printing those elements in the console print(X)
 1 3 5 7 8