# Vectors
## Vector = Collection of R_Objects of same class (types)
## Vectors: Recyling Rule
```{r}
vec_num_a <- c(1, 2, 3, 4, 5)
vec_num_a
class(vec_num_a)
vec_num_b <- c(6, 7)
vec_num_b
class(vec_num_b)
vec_num_c = vec_num_a + vec_num_b
vec_num_c
class(vec_num_c)
# a: 1 2 3 4 5
# b: 6 7
# b: 6 7 6 7 6 <-- repeated, since not long enough
# c: 7 9 9 11 11
```
## Vectors: Access: Element
```{r}
vec_num_d <- c(8, 9, 10, 11, 12)
vec_num_d[2]
vec_num_d[c(FALSE,TRUE,FALSE,FALSE,FALSE)]
vec_num_d[c(0,1,0,0,0)] # include index 1, index 0 has nothing
vec_num_d[c(0,1,0,3)] # include index 1 and 3, index 0 has nothing
vec_num_d[-2] # exclude index 2
vec_num_d[c(-2,-3)] # exclude index 2 and 3
vec_num_d[c(-3,-2)] # exclude index 3 and 2
#vec_num_d[c(2,-3)] # error:
# indices can be: {-}, {-,0}, {0,+}, {+}
```
## Vectors: Access: Subsets
```{r}
vec_num_e <- c(11, 12, 13, 14, 15)
vec_num_e[2:4]
```