-
Notifications
You must be signed in to change notification settings - Fork 5
/
README.Rmd
58 lines (40 loc) · 1.59 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
---
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-"
)
```
# eurolig
[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)
The eurolig package provides a set of tools to obtain and analyze basketball generated data from the Euroleague.
## Overview
* API wrapper around the official website of the [Euroleague](https://www.euroleague.net/).
* Functions to obtain stats, play-by-play data and shot location data in a tidy format within R.
* Tools to analyze and visualize the data.
## Installation
```{r, eval = FALSE}
# install.packages("devtools")
devtools::install_github("solmos/eurolig")
```
## Example
Let's say we want to analyze play-by-play data from the Championship game of the 2017-2018 season between Real Madrid and Fenerbache Dogus Istanbul. We can obtain the data by entering the game code and the season to the function `extractPbp()`. The game code for the game can be found in the game's [URL](https://www.euroleague.net/main/results/showgame?gamecode=260&seasoncode=E2017).
```{r}
library(eurolig)
pbp <- extractPbp(game_code = 260, season = 2017)
pbp
```
From these data we can extract information about the assists in that game from, say, Real Madrid (MAD):
```{r}
assists <- getAssists(pbp, team = "MAD")
assists
```
Shot location data can also be retrieved and visualized:
```{r}
shots <- extractShots(260, 2017)
plotShotchart(shots)
```