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)
Output
[[1]]
[1] "SBF"
[[2]]
[1] "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)
Output
[[1]]
[1] "SBF"
[[2]]
[1] TRUE
[[3]]
[1] 19
[[4]]
[1] 21.19
[[5]]
[1] 19 21
We created a list filled with multiple data type elements.
Further reading
Append an element to an empty list

Krunal Lathiya is a seasoned Computer Science expert with over eight years in the tech industry. He boasts deep knowledge in Data Science and Machine Learning. Versed in Python, JavaScript, PHP, R, and Golang. Skilled in frameworks like Angular and React and platforms such as Node.js. His expertise spans both front-end and back-end development. His proficiency in the Python language stands as a testament to his versatility and commitment to the craft.