Vectors in R
Explore the concept of vectors as basic one-dimensional data structures in R. Understand how to create vectors, select and filter elements, check for specific values, and replace data to maintain accuracy in data analysis tasks.
We'll cover the following...
Vector objects
Vectors act as containers of data elements, forming one-dimensional basic data structures that transform values into a single data type. Vectors can be sorted, filtered, and modified. We can generate vectors using the c() command.
Vector elements do not always keep the characteristics of their original data type if the vector includes more than one different data type. They converge in a data type that all the elements can be converted into.
The example below illustrates how the disparate data types of individual vector elements can be represented in a mutually compatible format.
Notice how the data types are automatically converted into a common one in the examples above. The original data types of 2i+3 and 3L are, ...