Created
February 27, 2017 20:28
-
-
Save clarkfitzg/60abb053935d7a958385b5a66cccc05e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = 1:3 | |
y = 11:13 | |
# Given vectors x, y, what's the cleanest general way to make z? | |
# z = c(1, 11, 2, 12, 3, 13) | |
shuffle = function(x, y) | |
{ | |
as.vector(mapply(c, x, y)) | |
} | |
z = shuffle(x, y) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment