# Types of Vectors in R Programming

## Vectors:

It is the simplest data structure in R Programming. It represents a sequence of data points of the same type. A vector can be created with the function x() (for collection or concatenation).

Example:
`> x(3,1,7)`

Output:
3 1 7

## Types of Vectors in R

1. Atomic Vectors: Atomic vectors are the most basic of all data structures. It contains some number of values of the same type; that number could be zero.

Atomic vectors can contain integers, doubles, and logical or character strings. Both complex numbers and raw (pure bytes) have atomic representations.

Example:
`> x = c(1, 2, 3, 4)`
`> x`

Output:
1 2 3 4

2. Zero-length Vectors: It describes the rules that apply to zero-length vectors for those computations. Here we also describe their behaviour in other settings.

Functions such as sum and prod take as input one or more vectors and produce a value of length one. It is very helpful if simple rules:

Example:
sum(c(x,y)) = sum(x) + sum(y), hold. Similarly, for prod we expect,
prod(c(x,y)) = prod(x)*prod(y). For these to hold, we require that the sum of a zero-length vector is zero and that the product of a zero-length vector be one.

`> sum(numeric())`

Output:
0

3. Character Vectors: In the S language, Character vectors are vectors of character strings, not vectors of characters.

Example: The string “webeduclick” would be represented as a character vector of length one, not of length 11.