The list()
function in R is used to create a list of elements of different types. A list can contain numeric, string, or vector elements.
list(...)
The list()
function takes a parameter value ...
indicating the R objects, which may or may not be named.
The list()
function returns a list that is composed of the arguments passed to it.
# creating Objects as arguments for the list functiona = c(1, 2, 3, 4, 5)b = c("A", "B", "C", "D", "E")c = c("A", "B", "c", "1", "2")# implementing the list() functionlist(a, b, c)
a
, b
, and c
that will serve as the argument to the list()
function.list()
function and passed the objects a
, b
, and c
as its arguments. We print the result to the console.