mosaic (version 0.14.4)

rspin: Simulate spinning a spinnner

Description

This is essentially rmultinom with a different interface.

Usage

rspin(n, probs, labels = 1:length(probs))

Arguments

n

number of spins of spinner

probs

a vector of probabilities. If the sum is not 1, the probabiliies will be rescaled.

labels

a character vector of labels for the categories

Examples

Run this code
# 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 DataCamp Workspace