Intercalate list values into a vector
intercalate(...)
... | parameters are expected as multiple vectors. |
---|
vector of values derived from each input list ...
, with
one element per list in order. In the event any list is shorter than
the others, its values are recycled so each list is equal length.
This function takes a list of vectors, and intercalates them by inserting alternating values from each vector to make one combined vector. It is analogous to shuffling a deck of cards, except that there could be more than two stacks of cards shuffled together.
Other jam list functions:
list2im()
A <- LETTERS[1:10]; B <- letters[1:10]; intercalate(A, B)#> [1] "A" "a" "B" "b" "C" "c" "D" "d" "E" "e" "F" "f" "G" "g" "H" "h" "I" "i" "J" #> [20] "j"