To append a list to another list in R, you can use the c
function or list concatenation.
In this example,
list1
and list2
with initial values.c
function to concatenate list2
to list1
.list1
to standard output.list1 <- c(1, 2, 3)
list2 <- c(4, 5, 6)
updated_list <- c(list1, list2)
print(updated_list)
[1] 1 2 3 4 5 6
In this example,
list1
and list2
with initial values.list2
to list1
.list1
to standard output.list1 <- c(1, 2, 3)
list2 <- c(4, 5, 6)
updated_list <- c(list1, list2)
print(updated_list)
[1] 1 2 3 4 5 6
In this tutorial, we learned How to Append a List to another List in R language with well detailed examples.