Let's say that I have two lists in R, not necessarily of equal length, like:
a <- list('a.1','a.2', 'a.3')
b <- list('b.1','b.2', 'b.3', 'b.4')
What is the best way to construct a list of interleaved elements where, once the element of the shorter list had been added, the remaining elements of the longer list are append at the end?, like:
interleaved <- list('a.1','b.1','a.2', 'b.2', 'a.3', 'b.3','b.4')
without using a loop. I know that mapply works for the case where both lists have equal length.