knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
"dieroller" is a minimal R package that
provides functions to simulate rolling a die.
die() creates a die object (of class "die")roll() rolls a die object, producing a "roll" object.plot() method for a "roll" object to plot frequencies of die sides.summary() method for a "roll" object.This package has been developed to illustrate some of the concepts behind the creation of an R package.
Install the development version from GitHub via the package
"devtools":
# development version from GitHub: #install.packages("devtools") # install "dieroller" (without vignettes) devtools::install_github("gastonstat/dieroller") # install "dieroller" (with vignettes) devtools::install_github("gastonstat/dieroller", build_vignettes = TRUE)
library(dieroller) # default die die1 <- die() die1 # 1 roll of die1 roll(die1) # 10 rolls of die1 rolls10 <- roll(die1, times = 10) rolls10 # summary summary(rolls10) # 100 rolls rolls100 <- roll(die1, times = 100) # summary summary(rolls100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.