forked from ffverse/ffscrapr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
126 lines (85 loc) · 5.27 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---
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%"
)
options(tibble.print_min = 5,
pillar.bold = TRUE,
pillar.min_chars = 25,
pillar.min_title_chars = 25,
dplyr.summarise.inform = FALSE,
rmarkdown.html_vignette.check_title = FALSE)
eval <- TRUE
tryCatch(expr = {
download.file("https://github.com/dynastyprocess/ffscrapr-tests/archive/main.zip","f.zip")
unzip('f.zip', exdir = ".")
httptest::.mockPaths(new = "ffscrapr-tests-main")},
warning = function(e) eval <<- FALSE,
error = function(e) eval <<- FALSE)
httptest::use_mock_api()
```
# ffscrapr <a href='#'><img src="man/figures/logo.svg" align="right" width="25%" min-width="120px"/></a>
*An R Client for Fantasy Football League APIs*
<!-- badges: start -->
[![CRAN status](https://img.shields.io/cran/v/ffscrapr?style=flat-square&logo=R&label=CRAN)](https://CRAN.R-project.org/package=ffscrapr)
[![Dev status](https://img.shields.io/github/r-package/v/dynastyprocess/ffscrapr/dev?label=dev&style=flat-square&logo=github)](https://ffscrapr.dynastyprocess.com/dev/)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-green.svg?style=flat-square)](https://lifecycle.r-lib.org/articles/stages.html)
[![Codecov test coverage](https://img.shields.io/codecov/c/github/dynastyprocess/ffscrapr?label=codecov&style=flat-square&logo=codecov)](https://codecov.io/gh/DynastyProcess/ffscrapr?branch=main)
[![R build status](https://img.shields.io/github/workflow/status/dynastyprocess/ffscrapr/R-CMD-check?label=R%20check&style=flat-square&logo=github)](https://github.com/DynastyProcess/ffscrapr/actions)
[![API status](https://img.shields.io/github/workflow/status/dynastyprocess/ffscrapr/Test%20APIs?label=API%20check&style=flat-square&logo=github)](https://github.com/DynastyProcess/ffscrapr/actions)
[![nflverse discord](https://img.shields.io/discord/591914197219016707.svg?color=5865F2&label=nflverse%20discord&logo=discord&logoColor=5865F2&style=flat-square)](https://discord.com/invite/5Er2FBnnQa)
<!-- badges: end -->
Helps access various Fantasy Football APIs (currently MFL, Sleeper, Fleaflicker, and ESPN - eventually Yahoo, potentially others) by handling authentication/rate-limiting/caching, forming appropriate calls, and returning tidy dataframes which can be easily connected to other data sources.
### Installation
Version 1.4.3 is now on CRAN :tada: and can be installed with:
```{r eval = FALSE}
install.packages("ffscrapr")
# or from GitHub release with the remotes package via:
# install.packages("remotes")
remotes::install_github("dynastyprocess/ffscrapr", ref = "v1.4.3")
```
Install the development version from GitHub with:
```{r eval = FALSE}
remotes::install_github("dynastyprocess/ffscrapr", ref = "dev")
```
The dev version has a [separate documentation site here](https://ffscrapr.dynastyprocess.com/dev/).
### Usage
All `ffscrapr` functions start with a connection object created by `ff_connect()`, which stores connection, authentication, and other user-defined parameters. This object is used by all other functions to help return the correct data.
```{r eval = eval, message = FALSE}
library(ffscrapr)
ssb <- ff_connect(platform = "mfl", league_id = "54040", season = 2020)
# Get a summary of league settings
ff_league(ssb) %>% str()
# Get rosters
ff_rosters(ssb)
# Get transactions
ff_transactions(ssb)
```
Platform-specific guides on getting started with ffscrapr are here:
- [MyFantasyLeague](https://ffscrapr.dynastyprocess.com/articles/mfl_basics.html)
- [Sleeper](https://ffscrapr.dynastyprocess.com/articles/sleeper_basics.html)
- [Fleaflicker](https://ffscrapr.dynastyprocess.com/articles/fleaflicker_basics.html)
- [ESPN](https://ffscrapr.dynastyprocess.com/articles/espn_basics.html)
There are also some more advanced guides for custom API calls in the [Articles section](https://ffscrapr.dynastyprocess.com/articles/), as well as some guides on [optimizing ffscrapr's performance](https://ffscrapr.dynastyprocess.com/articles/ffscrapr_caching.html).
### Support
The best places to get help on this package are:
- the [nflverse discord](https://discord.com/invite/5Er2FBnnQa) (for both this package as well as anything R/NFL related)
- opening [an issue](https://github.com/DynastyProcess/ffscrapr/issues/new/choose)
### Contributing
Many hands make light work! Here are some ways you can contribute to this project:
- You can [open an issue](https://github.com/DynastyProcess/ffscrapr/issues/new/choose) if you'd like to request specific data or report a bug/error.
- You can [sponsor this project with donations](https://github.com/sponsors/tanho63)!
- If you'd like to contribute code, please check out [the contribution guidelines](https://ffscrapr.dynastyprocess.com/CONTRIBUTING.html).
### Terms of Use
The R code for this package is released as open source under the [MIT license](https://ffscrapr.dynastyprocess.com/LICENSE.html).
The APIs and data accessed by this package belong to their respective owners, and are governed by their terms of use.
```{r include = FALSE}
httptest::stop_mocking()
unlink(c("ffscrapr-tests-main","f.zip"), recursive = TRUE, force = TRUE)
```