-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
75 lines (53 loc) · 2.15 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# winaRaque
<!-- badges: start -->
[![R-CMD-check](https://github.com/Alexis-vs/winaRaque/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/Alexis-vs/winaRaque/actions/workflows/R-CMD-check.yaml)
[![Scrape NBA matchs](https://github.com/Alexis-vs/winaRaque/actions/workflows/nba_matchs_scrap.yml/badge.svg)](https://github.com/Alexis-vs/winaRaque/actions/workflows/nba_matchs_scrap.yml)
<!-- badges: end -->
The goal of winaRaque is to explore sport data and make analysis with sport betting odds. The first analyzes will be done through the NBA.
## Installation
You can install the development version of winaRaque from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("Alexis-vs/winaRaque")
```
## Example
You can get NBA results with 1/2 odds for a day.
```{r example}
library(winaRaque)
get_nba_scores("2023-10-30", pivot_results = TRUE)
```
## Small data visualization
```{r}
# the workflow has been taking the odds since 2023-03-20
seq_date <- seq.Date(from = as.Date("2023-10-24"), # NBA opening 2023-2024
to = Sys.Date(),
by = "day")
list_results <- lapply(seq_date, get_nba_scores, pivot_results = TRUE)
results <- do.call("rbind", list_results)
```
```{r, message=FALSE, warning=FALSE}
library(ggplot2)
library(dplyr)
results %>%
ggplot(aes(x = Name, y = Odd, color = WINLOSE)) +
geom_boxplot() +
theme(axis.text.x = element_text(angle = 90, vjust = 0.5)) +
ggtitle("Odds distribution according to result", subtitle = "by teams - season 2023-2024")
```
## Data collect
A workflow run everyday to get all NBA odds for the night. The results are in `inst/extdata`.
An other workflow run every morning to collect odds for shiny app. The results are in `shiny` folder.
## Shiny
Shiny app to explore 'surbet' variations during games of 1/2 sports (tennis, basketball, baseball). Run the Shiny app with `app.R`.