Skip to content

Instantly share code, notes, and snippets.

@MarkZhangTW
Created November 27, 2019 10:41
Show Gist options
  • Save MarkZhangTW/c3d21fcc76a822f83fb5ce6cc030a7d2 to your computer and use it in GitHub Desktop.
Save MarkZhangTW/c3d21fcc76a822f83fb5ce6cc030a7d2 to your computer and use it in GitHub Desktop.
permute a matrix
permute = function (m) t(apply(X = m, MARGIN = 1, FUN = function(v) v[sample(length(v))]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment