knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "README-"
)

Overview

"cointoss" is a minimal R package that provides functions to simulate tossing a coin.

Motivation

This package has been developed to illustrate some of the concepts behind the creation of an R package.

Installation

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)

Usage

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)


gastonstat/cointoss documentation built on May 5, 2023, 6:46 p.m.