Last data update: 2014.03.03

R: Datasets for Probabilistic Simulation
Datasets for SimulationR Documentation

Datasets for Probabilistic Simulation

Description

For performing elementary probability calculations in introductory statistic courses, there might datasets of playing cards casually be wanted. 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. tarot does the same with a classic tarot deck.

Usage

cards
tarot
roulette

Value

cards is a data.frame with two columns named rank and suit

tarot is a data.frame with three columns named rank, suit and desc

roulette is a data.frame with two columns named num and col

Examples

head(cards)
head(tarot)
head(roulette)

# drawing 5 cards
sample(do.call(paste, cards), 5)

# spin the wheel
sample(do.call(paste, roulette), 1)

# simulate the evening in Las Vegas
sample(do.call(paste, roulette), 32, replace=TRUE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(DescTools)
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/DescTools/DatasetsforSimulation.Rd_%03d_medium.png", width=480, height=480)
> ### Name: Datasets for Simulation
> ### Title: Datasets for Probabilistic Simulation
> ### Aliases: cards tarot roulette
> ### Keywords: datasets
> 
> ### ** Examples
> 
> head(cards)
  rank suit
1    2 club
2    3 club
3    4 club
4    5 club
5    6 club
6    7 club
> head(tarot)
  rank  suit desc
1    1 wands <NA>
2    2 wands <NA>
3    3 wands <NA>
4    4 wands <NA>
5    5 wands <NA>
6    6 wands <NA>
> head(roulette)
  num   col
1   0 white
2  26 black
3   3   red
4  35 black
5  12   red
6  28 black
> 
> # drawing 5 cards
> sample(do.call(paste, cards), 5)
[1] "7 heart"   "8 spade"   "4 diamond" "4 club"    "8 club"   
> 
> # spin the wheel
> sample(do.call(paste, roulette), 1)
[1] "13 black"
> 
> # simulate the evening in Las Vegas
> sample(do.call(paste, roulette), 32, replace=TRUE)
 [1] "12 red"   "5 red"    "13 black" "18 red"   "31 black" "9 red"   
 [7] "16 red"   "4 black"  "14 red"   "20 black" "30 red"   "27 red"  
[13] "13 black" "9 red"    "4 black"  "34 red"   "18 red"   "12 red"  
[19] "13 black" "26 black" "32 red"   "13 black" "2 black"  "31 black"
[25] "15 black" "35 black" "34 red"   "1 red"    "8 black"  "24 black"
[31] "21 red"   "18 red"  
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>