knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
"cointoss"
is a minimal R package
that provides functions to simulate tossing a coin.
coin()
creates a coin object (of class "coin"
)toss()
tosses a coin object, producing a "toss"
object.plot()
method for a "toss"
object to plot frequencies of heads.summary()
method for a "toss"
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 "cointoss" (without vignettes) devtools::install_github("gastonstat/cointoss") # install "cointoss" (with vignettes) devtools::install_github("gastonstat/cointoss", build_vignettes = TRUE)
library(cointoss) # default coin coin1 <- coin() coin1 # 1 toss of coin1 toss(coin1) # 10 tosses of coin1 toss10 <- toss(coin1, times = 10) toss10 # summary summary(toss10) # 100 tosses toss100 <- toss(coin1, times = 100) # summary summary(toss100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.