| list2 | R Documentation |
List with objects that are automatically named.
list2(...)
... |
Objects to include in the list. Objects are automatically named based on their variable names unless explicit names are provided. |
list2(x , y) is equivalent to list(x = x , y = y)
list2(x , y2 = y) is equivalent to list(x = x , y2 = y)
A named list. Each element is named after the variable passed to
the function (or the explicit name if provided). The structure is identical
to a standard R list created with list.
x <- 1:5
y <- letters[1:3]
z <- matrix(1:4, nrow = 2)
# Create named list from objects
my_list <- list2(x, y, z)
names(my_list) # "x" "y" "z"
# Works with explicit names too
my_list2 <- list2(a = x, b = y)
names(my_list2) # "a" "b"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.