How to merge two lists in R?Explain with example
Let us define two lists and merge it. A list can contain an array of elements of any data types be it integer, character or float.
first_list = list(a = 1, b = 2, c = 3)
second_list = list(a = 2, b = 3, c = 4)
To merge it, we can apply mapply()
mapply() is a function which can be applied to multiple lists or vector elements.
mapply(c, first_list, second_list, SIMPLIFY=FALSE)