Skip to content
master
Go to file
Code

Latest commit

Krasser Roland Krasser Roland
Krasser Roland and Krasser Roland update NEWS
fcea3e2

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
man
Jan 7, 2020
Dec 27, 2019
Dec 1, 2019
Dec 1, 2019
Jan 7, 2020

README.md

CRAN Version Downloads Total Downloads

tidydice

Simulates Dice Rolls and Coin Flips.

Introduction

A basic understanding of probability and statistics is crucial for data understanding. A great way to teach probability and statistics is to start with an experiment, like rolling a dice or flipping a coin.

This package simulates rolling a dice and flipping a coin. Each experiment generates a tibble. Dice rolls and coin flips are simulated using sample(). The properties of the dice can be changed, like the number of sides. A coin flip is simulated using a two sided dice. Experiments can be combined with the pipe-operator.

Installation

CRAN

install.packages("tidydice")

DEV version (github)

# install from github
if (!require(devtools)) install.packages("devtools")
devtools::install_github("rolkra/tidydice")

if you are behind a firewall, you may want to:

  • Download and unzip the tidydice package
  • Then install it with devtools::install_local
# install local
if (!require(devtools)) install.packages("devtools")
devtools::install_local(path = <path of local package>, force = TRUE)

Example

# load packages
library(tidyverse)
library(tidydice)

# roll a dice
roll_dice()

# roll a dice 6x
roll_dice(times = 6)

# roll a dice 6x and plot result
roll_dice(times = 6) %>% 
  plot_dice()

# repeat 6x
roll_dice(times = 6, rounds = 6) %>% 
  plot_dice()

# count success per round
roll_dice(times = 6, rounds = 6, agg = TRUE)

# Binomial distribution
binom_dice(times = 6)
  
# Binomial distribution + plot
binom_dice(times = 6) %>% 
  plot_binom()

# Binomial distribution + plot 
binom_dice(times = 6) %>% 
  plot_binom(highlight = 0:2)

About

tidy data from rolling a dice

Resources

Releases

No releases published

Packages

No packages published

Languages

You can’t perform that action at this time.