Skip to content

Instantly share code, notes, and snippets.

@clarkfitzg
Created February 27, 2017 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clarkfitzg/60abb053935d7a958385b5a66cccc05e to your computer and use it in GitHub Desktop.
Save clarkfitzg/60abb053935d7a958385b5a66cccc05e to your computer and use it in GitHub Desktop.
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