To create a vector of vectors in R, you can use nested lists.
In this example,
# Create a vector of vectors
vector_of_vectors <- list(
numeric_vector = c(1, 2, 3),
character_vector = c("a", "b", "c"),
logical_vector = c(TRUE, FALSE, TRUE)
)
# Print the vector of vectors
print(vector_of_vectors)
List of 3 $ numeric_vector : num [1:3] 1 2 3 $ character_vector: chr [1:3] "a" "b" "c" $ logical_vector : logi [1:3] TRUE FALSE TRUE
In this tutorial, we learned How to create a Vector of Vectors in R language with well detailed examples.