--6-Lists
#Within a column all elements have the same data type,
#but different columns can be of different data type.#A list in R allows you to gather a variety of
#objects under one name
#(that is, the name of the list) in an ordered way.
#These objects can be matrices, vectors, data frames,
#even other lists, etc.
#It is not even required that these objects are related
#to each other
#in any way#Construct a list, named my_list, that contains
#the variables my_vector,
#my_matrix and my_df as list components.
# Vector with numerics from 1 up to 10
my_vector <- 1:10
# Matrix with numerics from 1 up to 9
my_matrix <- matrix(1:9, ncol = 3)
# First 10 elements of the built-in data frame mtcars
my_df <- mtcars[1:10,]
# Construct list with these different elements:
my_list <- list(my_vector,my_matrix,my_df)
my_listLast updated