To join lists in R, you can use the `c` function to combine multiple lists into a single list.
In this example,
list1
and list2
with integer values.c
function to join list1
and list2
into a new list named joined_list
.list1 <- list(1, 2, 3)
list2 <- list(4, 5, 6)
joined_list <- c(list1, list2)
print(paste("Joined List:", joined_list))
Joined List: 1 2 3 4 5 6
In this example,
listA
, listB
, and listC
with string values.c
function to join listA
, listB
, and listC
into a new list named result_list
.listA <- list("apple", "banana")
listB <- list("cherry", "date")
listC <- list("fig", "grape")
result_list <- c(listA, listB, listC)
print(paste("Joined List:", result_list))
Joined List: apple banana cherry date fig grape
In this tutorial, we learned How to Join Lists in R language with well detailed examples.