| Datasets for Simulation | R Documentation |
For performing elementary probability calculations in introductory statistic courses, we might want to simulate random games.
The dataset roulette contains the standard sample space for one spin on a roulette wheel.
cards contains the standard set of 52 playing cards in four colours (without Jokers). tarot does the same with a classic tarot deck.
cards
tarot
roulette
cards is a data.frame with three columns named card, rank and suit
tarot is a data.frame with four columns named card, rank, suit and desc
roulette is a data.frame with seven columns named num and col, parity, highlow, dozens, column, pocketrange
Sample, sample()
head(cards)
head(tarot)
head(roulette)
# drawing 5 cards
sample(cards$card, 5)
# drawing 5 cards with jokers
sample(c(cards$card, rep("Joker", 3)), 5)
# spin the wheel by using the DescTools::Sample() for sampling
# rows from a data frame
Sample(roulette, size=1)
# simulate the evening in Las Vegas with 10 games
Sample(roulette, 10, replace=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.