-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
README.Rmd
127 lines (90 loc) · 5.17 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
127
---
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/ffverse/ffscrapr-tests/archive/1.4.7.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/ffverse/ffscrapr/main?label=dev&style=flat-square&logo=github)](https://ffscrapr.ffverse.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/ffverse/ffscrapr?label=codecov&style=flat-square&logo=codecov)](https://app.codecov.io/gh/ffverse/ffscrapr?branch=main)
[![R build status](https://img.shields.io/github/actions/workflow/status/ffverse/ffscrapr/R-CMD-check.yaml?label=R%20check&style=flat-square&logo=github)](https://github.com/ffverse/ffscrapr/actions)
[![API status](https://img.shields.io/github/actions/workflow/status/ffverse/ffscrapr/test-apis.yml?label=API%20check&style=flat-square&logo=github)](https://github.com/ffverse/ffscrapr/actions)
[![nflverse discord](https://img.shields.io/discord/789805604076126219?color=7289da&label=nflverse%20discord&logo=discord&logoColor=fff&style=flat-square)](https://discord.com/invite/5Er2FBnnQa)
<!-- badges: end -->
Helps access various Fantasy Football APIs (currently MFL, Sleeper, Fleaflicker, and ESPN - perhaps eventually Yahoo and others) by handling authentication/rate-limiting/caching, forming appropriate calls, and returning tidy dataframes which can be easily connected to other data sources.
### Installation
Install the stable version of this package from CRAN:
```{r eval = FALSE}
install.packages("ffscrapr")
```
Install the development version from either [r-universe](https://ffverse.r-universe.dev) or GitHub:
```{r eval = FALSE}
install.packages("ffscrapr", repos = c("https://ffverse.r-universe.dev", getOption("repos")))
# pak is recommended, see https://github.com/r-lib/pak
pak::pak("ffverse/ffscrapr")
# can also use remotes
remotes::install_github("ffverse/ffscrapr")
```
### 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.ffverse.com/articles/mfl_basics.html)
- [Sleeper](https://ffscrapr.ffverse.com/articles/sleeper_basics.html)
- [Fleaflicker](https://ffscrapr.ffverse.com/articles/fleaflicker_basics.html)
- [ESPN](https://ffscrapr.ffverse.com/articles/espn_basics.html)
There are also some more advanced guides for custom API calls in the [Articles section](https://ffscrapr.ffverse.com/articles/), as well as some guides on [optimizing ffscrapr's performance](https://ffscrapr.ffverse.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/ffverse/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/ffverse/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.ffverse.com/CONTRIBUTING.html).
### Terms of Use
The R code for this package is released as open source under the [MIT license](https://ffscrapr.ffverse.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-1.4.7","f.zip"), recursive = TRUE, force = TRUE)
```