Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rspin

Simulate spinning a spinner


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 probabilities will be rescaled.

labels

a character vector of labels for the categories

Examples

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"))

mosaic

Project MOSAIC Statistics and Mathematics Teaching Utilities

v1.8.3
GPL (>= 2)
Authors
Randall Pruim [aut, cre], Daniel T. Kaplan [aut], Nicholas J. Horton [aut]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.