-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathREADME.Rmd
76 lines (51 loc) · 1.34 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
output:
github_document:
html_preview: false
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```
## Overview
`"cointoss"` is a minimal [R](http://www.r-project.org/) 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.
## 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"`:
```r
# 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
```{r}
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)
```