To create a list in R, you can use the “list()” function. It accepts single or multiple arguments and returns the list.
lt <- list("SBF", "Alameda") print(lt)
[]  "SBF" []  "Alameda"
You can see that we created a list with two elements.
To print the data in the console, use the print() function.
Creating a list with different data types
lt <- list("SBF", TRUE, 19, 21.19, c(19, 21)) print(lt)
[]  "SBF" []  TRUE []  19 []  21.19 []  19 21
We created a list filled with multiple data type elements.