# The most common case is to interleave two vectors
vec_interleave(1:3, 4:6)
# But you aren't restricted to just two
vec_interleave(1:3, 4:6, 7:9, 10:12)
# You can also interleave data frames
x <- data_frame(x = 1:2, y = c("a", "b"))
y <- data_frame(x = 3:4, y = c("c", "d"))
vec_interleave(x, y)
Run the code above in your browser using DataLab