R: combine two lists with same column names

Viewed 875

I have two list elements:

List1[[1]] = {c(1,1,2), c(1,2,3), c(1,3,4)}

List2[[1]] = {c(2,1,5), c(2,2,6), c(2,3,7)}

I am trying to combine both the lists and produce another list:

List3[[1]] = {c(1,1,2), c(1,2,3), c(1,3,4), c(2,1,5), c(2,2,6), c(2,3,7)}

Can someone please help in how to combine these two lists into 1?

Both the lists have same column names, but different row values. The second column is recurring (as mentioned in the example!)

I have tried the combine function and merge function but they both are giving different results than expected.

1 Answers

Here is one option with Map where we concatenate (c) the corresponding list elements to a single one

Map(c, List1, List2)
Related