Vector – R Language Tutorial

In R  language a vector is the sequence of data elements of same basic type. Elements or values in a vector are officially called components. But, we can just call them as members also if we want.

Vector examples

Vector is a very common term in R Language.

Here is a vector containing three numeric values 1, 2, 3 and 8.

Just like numerical values, a vector can contain string values. But all of the components should be strings in that vector. Here is an example:

If we want to get the length of the vector then we can call length function:

For your information, we can create boolean vectors also. You can see an example below: