in R, what is the difference between a vector and a list? code example
Example: r lists vs vectors
# Short answer:
# Vectors (aka Atomic vectors) and lists are both one-dimensional objects
# but vectors can only contain one type of data, whereas lists can
# contain mixed type data.
# Note, if you combine mixed types in a vector, they will be coerced to
# the most flexible type of the types you used. In order of increasing
# flexibility, the types are: logical -> integer -> double -> character
# Note, to determine whether you're dealing with a vector or a list use
# typeof(vector_or_list) -- typeof(a_list) will return "list"