This repository has been archived by the owner on Feb 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
69 lines (48 loc) · 2.3 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# rugger
:new_zealand: :ireland: `r emo::ji("wales")` `r emo::ji("england")` :south_africa: :australia: `r emo::ji("scotland")` :fiji: ^[Black flags?! They're Github's fault. The flags represent the rankings as of the end of 2018 -- New Zealand, Ireland, Wales, England, South Africa, Australia, Scotland and Fiji. You can see them in R with `emo::ji("wales")`, for example, using the emo package, available from [https://github.com/hadley/emo](https://github.com/hadley/emo).]
rugger is a rrrrugby package :rugby_football:. Get stats on teams, players, rankings and calculate changes in the rankings for a certain match.
## Installation
You can install rugger with:
``` {r eval = FALSE}
remotes::install_github("RobertMyles/rugger")
```
I won't be burdening CRAN with it.
## Usage
You can see the current world rankings with `get_rankings()`:
```{r}
library(rugger)
get_rankings()
```
Hmmm, what would happen if New Zealand played Ireland tomorrow, and Ireland won by 5 points?
```{r}
calculate_rank("New Zealand", "Ireland", score = c(15, 20))
```
Let's have a look at the history between England and Scotland, the first two teams to play the game:
```{r}
get_team_records("England", "Scotland")
```
England winning almost 62% of the matches there.
I wonder which player has scored most tries in rugby?
```{r message=FALSE, warning=FALSE}
library(dplyr)
get_team_records(type = "player") %>%
arrange(desc(points)) %>%
select(player, points)
```
The sublime Dan Carter!
## Data etc.
All of the data acessed by this package is obviously for informational/educational use, and a big thanks to all for making it available.
It belongs to [World Rugby](https://www.world.rugby/rankings/mru) and [ESPN](http://stats.espnscrum.com/statsguru/rugby/stats/index.html). The algorithm that calculates the rankings also belongs to World Rugby, you can read about it [here](https://www.world.rugby/rankings/explanation).
Some of the data is also pulled from [Pick and Go](http://www.lassen.co.nz/pickandgo.php) by [Lassen Creative Technologies](http://www.datacleanse.co.nz/).