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.

0 1 2 3 |
> c(1, 2, 3, 8) [1] 1 2 3 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:

0 1 2 3 |
c("aaa", "bbb", "ccc", "ddd", "eee") [1] "aaa" "bbb" "ccc" "ddd" "eee" |

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

function:

0 1 2 3 4 |
my_vector <- c("abc", "def", "ghi", "jkl", "mno") length(my_vector) [1] 5 |

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

0 1 2 3 |
c(TRUE, FALSE, TRUE, FALSE, FALSE) [1] TRUE FALSE TRUE FALSE FALSE |