R Vector and List are not similar, but not the same. Vectors are composed of ONE data type, while lists are composed of ONE or MORE data types.

#This is a list
thislist <- list("apricot", "banana", "coconut")
thislist[1]
## [[1]]
## [1] "apricot"
# This is a vector
thisvector <- c("apricot", "banana", "coconut")
thisvector[1]
## [1] "apricot"
# Finding the length of a vector and a list

length(thislist)
## [1] 3
length(thisvector)
## [1] 3
"apricot" %in% thislist
## [1] TRUE
"apricot" %in% thisvector
## [1] TRUE
append(thislist, "mango")
## [[1]]
## [1] "apricot"
## 
## [[2]]
## [1] "banana"
## 
## [[3]]
## [1] "coconut"
## 
## [[4]]
## [1] "mango"
append(thisvector, "mango")
## [1] "apricot" "banana"  "coconut" "mango"
append(thislist, "lemon", after = 2)
## [[1]]
## [1] "apricot"
## 
## [[2]]
## [1] "banana"
## 
## [[3]]
## [1] "lemon"
## 
## [[4]]
## [1] "coconut"
append(thisvector, "lemon", after = 2)
## [1] "apricot" "banana"  "lemon"   "coconut"

Merging Vectors and Lists

list1 <- list("a", "b", "c")
list2 <- list(1, 2, 3)
 
vector1 <- c("a", "b", "c")
vector2 <- c(1, 2, 3)
 
list3 <- c(list1,list2)
vector3 <- c(vector1,vector2)



list3
## [[1]]
## [1] "a"
## 
## [[2]]
## [1] "b"
## 
## [[3]]
## [1] "c"
## 
## [[4]]
## [1] 1
## 
## [[5]]
## [1] 2
## 
## [[6]]
## [1] 3
vector3
## [1] "a" "b" "c" "1" "2" "3"