Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thomaszwagerman/fplboard
Shiny app leveraging Fantasy Premier League's API data. Developed as a package using the golem framework.
https://github.com/thomaszwagerman/fplboard
fpl fpl-api
Last synced: 6 days ago
JSON representation
Shiny app leveraging Fantasy Premier League's API data. Developed as a package using the golem framework.
- Host: GitHub
- URL: https://github.com/thomaszwagerman/fplboard
- Owner: thomaszwagerman
- License: other
- Created: 2022-08-28T16:18:00.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-17T15:45:22.000Z (4 months ago)
- Last Synced: 2024-08-17T16:45:35.023Z (4 months ago)
- Topics: fpl, fpl-api
- Language: R
- Homepage: https://tzwagerman.shinyapps.io/fplboard/
- Size: 2.01 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
---
output: github_document
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```# fplboard
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![Codecov test coverage](https://codecov.io/gh/thomaszwagerman/fplboard/branch/main/graph/badge.svg)](https://app.codecov.io/gh/thomaszwagerman/fplboard?branch=main)
[![R-CMD-check](https://github.com/thomaszwagerman/fplboard/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/thomaszwagerman/fplboard/actions/workflows/R-CMD-check.yaml)The goal of fplboard is to create a dashboard to easily extract useful information from the FPL API.
This dashboard is built on top of [fplscrapR](https://github.com/wiscostret/fplscrapR), but also has its own native functions.
fplboard is built in a modular way using the golem framework. Each module has its own functionality and is an individual menu item, meaning features will be added to this package slowly over time.
## Installation
You can install the development version of fplboard like so:
``` r
remotes::install_github("thomaszwagerman/fplboard")library(fplboard)
```If you want to run the app locally, all you need to do is:
```r
devtools::load_all()run_app()
```## Examples
This is a basic example which shows a function that return expected points table for a given team.
Under the hood it relies on `fplscrapR`'s `get_entry_player_picks()` and `get_player_info()` functions.
Let's have a look at the table:
```{r example, echo = FALSE, message = FALSE, warning = FALSE, eval = FALSE}
library(fplboard)
library(knitr)benchwarmers <- get_ep_for_entrant(entrant_number = 9680, gameweek = get_current_gw_number())
benchwarmers <- benchwarmers |>
dplyr::select(.data$team_code, .data$photo,
"Player" = .data$playername,
"Expected Points" = .data$ep_next,
"Selected by (%)" = .data$selected_by_percent) |>
gt::gt() |>
gtExtras::gt_img_rows(.data$photo, img_source = "web") |>
gtExtras::gt_img_rows(.data$team_code, img_source = "web") |>
gt::cols_label(
team_code = "",
photo = ""
) |>
gt::tab_row_group(
label = "Bench",
rows = c(12:15)
) |>
gt::tab_row_group(
label = "Starting 11",
rows = c(1:11)
)```
Another bit of functionality is plotting minileague point over time, using `fplscrapR::get_league_entries()` information:
``` {r point_plot, fig.height = 8, fig.width = 16, echo = FALSE, warning = FALSE}
library(fplboard)
library(ggplot2)
plot_league_points(570437)
```Or by rank for each gameweek:
``` {r ranked_plot, fig.height = 8, fig.width = 16, echo = FALSE, warning = FALSE}
library(fplboard)
library(ggplot2)
plot_league_standings(570437)
```