powered by
This is essentially rmultinom with a different interface.
rmultinom
rspin(n, probs, labels = 1:length(probs))
number of spins of spinner
a vector of probabilities. If the sum is not 1, the probabiliies will be rescaled.
a character vector of labels for the categories
# NOT RUN { rspin(20, prob=c(1,2,3), labels=c("Red", "Blue", "Green")) do(2) * rspin(20, prob=c(1,2,3), labels=c("Red", "Blue", "Green")) # }
Run the code above in your browser using DataLab