Skip to content

Instantly share code, notes, and snippets.

@alaiacano
Last active December 10, 2015 23:39
Show Gist options
  • Save alaiacano/4511143 to your computer and use it in GitHub Desktop.
Save alaiacano/4511143 to your computer and use it in GitHub Desktop.
values <- c('a', 'b', 'c')
probs <- c(.2, .5, .3)
sample(values, 10, replace=TRUE, prob=probs)
# [1] "a" "b" "a" "a" "c" "a" "c" "b" "c" "b"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment