Skip to content

Commit 142d16e

Browse files
authored
Merge pull request #42 from kiernann/v2.2.0
Update package for 2023 season
2 parents b44d595 + a4f435b commit 142d16e

28 files changed

+1811
-1769
lines changed

.github/workflows/check-standard.yaml

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
22
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
33
on:
44
push:
@@ -18,7 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
config:
21-
- {os: macOS-latest, r: 'release'}
21+
- {os: macos-latest, r: 'release'}
2222
- {os: windows-latest, r: 'release'}
2323
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
2424
- {os: ubuntu-latest, r: 'release'}
@@ -29,30 +29,21 @@ jobs:
2929
R_KEEP_PKG_SOURCE: yes
3030

3131
steps:
32-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v3
3333

34-
- uses: r-lib/actions/setup-pandoc@v1
34+
- uses: r-lib/actions/setup-pandoc@v2
3535

36-
- uses: r-lib/actions/setup-r@v1
36+
- uses: r-lib/actions/setup-r@v2
3737
with:
3838
r-version: ${{ matrix.config.r }}
3939
http-user-agent: ${{ matrix.config.http-user-agent }}
4040
use-public-rspm: true
4141

42-
- uses: r-lib/actions/setup-r-dependencies@v1
42+
- uses: r-lib/actions/setup-r-dependencies@v2
4343
with:
44-
extra-packages: rcmdcheck
44+
extra-packages: any::rcmdcheck
45+
needs: check
4546

46-
- uses: r-lib/actions/check-r-package@v1
47-
48-
- name: Show testthat output
49-
if: always()
50-
run: find check -name 'testthat.Rout*' -exec cat '{}' \; || true
51-
shell: bash
52-
53-
- name: Upload check results
54-
if: failure()
55-
uses: actions/upload-artifact@main
47+
- uses: r-lib/actions/check-r-package@v2
5648
with:
57-
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
58-
path: check
49+
upload-snapshots: true

.github/workflows/pkgdown.yaml

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,48 @@
1-
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
22
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
33
on:
44
push:
55
branches: [main, master]
6-
tags: ['*']
6+
pull_request:
7+
branches: [main, master]
8+
release:
9+
types: [published]
10+
workflow_dispatch:
711

812
name: pkgdown
913

1014
jobs:
1115
pkgdown:
1216
runs-on: ubuntu-latest
17+
# Only restrict concurrency for non-PR jobs
18+
concurrency:
19+
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
1320
env:
1421
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
22+
permissions:
23+
contents: write
1524
steps:
16-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3
1726

18-
- uses: r-lib/actions/setup-pandoc@v1
27+
- uses: r-lib/actions/setup-pandoc@v2
1928

20-
- uses: r-lib/actions/setup-r@v1
29+
- uses: r-lib/actions/setup-r@v2
2130
with:
2231
use-public-rspm: true
2332

24-
- uses: r-lib/actions/setup-r-dependencies@v1
33+
- uses: r-lib/actions/setup-r-dependencies@v2
2534
with:
26-
extra-packages: pkgdown
35+
extra-packages: any::pkgdown, local::.
2736
needs: website
2837

29-
- name: Deploy package
30-
run: |
31-
git config --local user.name "$GITHUB_ACTOR"
32-
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
33-
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
38+
- name: Build site
39+
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
40+
shell: Rscript {0}
41+
42+
- name: Deploy to GitHub pages 🚀
43+
if: github.event_name != 'pull_request'
44+
uses: JamesIves/github-pages-deploy-action@v4.4.1
45+
with:
46+
clean: false
47+
branch: gh-pages
48+
folder: docs

.github/workflows/test-coverage.yaml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
22
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
33
on:
44
push:
@@ -15,16 +15,36 @@ jobs:
1515
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1616

1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
1919

20-
- uses: r-lib/actions/setup-r@v1
20+
- uses: r-lib/actions/setup-r@v2
2121
with:
2222
use-public-rspm: true
2323

24-
- uses: r-lib/actions/setup-r-dependencies@v1
24+
- uses: r-lib/actions/setup-r-dependencies@v2
2525
with:
26-
extra-packages: covr
26+
extra-packages: any::covr
27+
needs: coverage
2728

2829
- name: Test coverage
29-
run: covr::codecov()
30+
run: |
31+
covr::codecov(
32+
quiet = FALSE,
33+
clean = FALSE,
34+
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
35+
)
3036
shell: Rscript {0}
37+
38+
- name: Show testthat output
39+
if: always()
40+
run: |
41+
## --------------------------------------------------------------------
42+
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
43+
shell: bash
44+
45+
- name: Upload test results
46+
if: failure()
47+
uses: actions/upload-artifact@v3
48+
with:
49+
name: coverage-test-failures
50+
path: ${{ runner.temp }}/package

DESCRIPTION

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
Package: fflr
22
Title: Retrieve ESPN Fantasy Football Data
3-
Version: 2.1.0.9101
3+
Version: 2.2.0
44
Authors@R:
5-
person(given = "Kiernan",
6-
family = "Nicholls",
7-
role = c("aut", "cre", "cph"),
8-
email = "kiernann@protonmail.com")
5+
person("Kiernan", "Nicholls", , "kiernann@protonmail.com", role = c("aut", "cre", "cph"))
96
Description: Format the raw data from the ESPN fantasy football API
107
<https://fantasy.espn.com/apis/v3/games/ffl/> as data frames.
118
Retrieve data on public leagues, rosters, athletes, and matches.
@@ -15,6 +12,7 @@ Depends:
1512
Imports:
1613
httr (>= 1.4.2),
1714
jsonlite (>= 1.7.2),
15+
stats,
1816
tibble (>= 3.1.3)
1917
Suggests:
2018
knitr (>= 1.34),
@@ -29,4 +27,4 @@ Encoding: UTF-8
2927
Language: en-US
3028
LazyData: true
3129
Roxygen: list(markdown = TRUE)
32-
RoxygenNote: 7.2.1
30+
RoxygenNote: 7.2.3

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ importFrom(httr,user_agent)
5959
importFrom(jsonlite,fromJSON)
6060
importFrom(jsonlite,toJSON)
6161
importFrom(jsonlite,unbox)
62+
importFrom(stats,median)
6263
importFrom(tibble,as_tibble)
6364
importFrom(tibble,tibble)

NEWS.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
# fflr (development version)
1+
# fflr 2.2.0
22

3+
* **Package has been updated for the 2023 season!**
4+
* Functions now use `seasonId = 2023` by default in `ffl_api()`.
5+
* Update objects with latest data from 2023 season.
36
* Fix `nfl_players` to include actually all of the players.
47
* Adjust the free agent information in `nfl_teams`.
58
* Add more function tests.
69
* Add `bonusWin` column to `live_scoring()`.
710

811
# fflr 2.1.0
912

10-
* **Package has been updated for the 2022 season!**
11-
* Functions now use `seasonId = 2022` by default in `ffl_api()`.
13+
* Functions now use `seasonId = 2022` by default in `ffl_api()`.
1214

1315
# fflr 2.0.2
1416

R/api.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#' be called? If `TRUE`, a list of results is returned, with one element for
1212
#' each historical year of the league.
1313
#' @param seasonId Integer year of NFL season. By default, the season is
14-
#' currently set to 2022. Use a recent year or set `leagueHistory` to `TRUE`
14+
#' currently set to 2023. Use a recent year or set `leagueHistory` to `TRUE`
1515
#' to obtain all past data.
1616
#' @param scoringPeriodId Integer week of NFL season. By default, `NULL` will
1717
#' use the current week (see [ffl_week()]). Scoring periods are always one
@@ -29,7 +29,7 @@
2929
#' @keywords internal
3030
#' @export
3131
ffl_api <- function(leagueId = ffl_id(), view = NULL, leagueHistory = FALSE,
32-
seasonId = 2022, scoringPeriodId = NULL, ...) {
32+
seasonId = 2023, scoringPeriodId = NULL, ...) {
3333
dots <- list(..., scoringPeriodId = scoringPeriodId)
3434
age_path <- ifelse(
3535
test = isTRUE(leagueHistory),

R/data.R

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#' 2022 NFL Players
1+
#' 2023 NFL Players
22
#'
3-
#' All available ESPN fantasy football players as of the 2022 season, week 1.
3+
#' All available ESPN fantasy football players as of the 2023 season, week 1.
44
#'
55
#' @format A data frame with 1,102 rows and 11 variables:
66
#' \describe{
@@ -14,15 +14,17 @@
1414
#' \item{height}{Height in integer inches}
1515
#' \item{age}{Current age in integer year}
1616
#' \item{dateOfBirth}{Date of birth}
17+
#' \item{birthPlace}{Place of birth}
1718
#' \item{debutYear}{Season debuted in league}
19+
#' \item{draftSelection}{Overall pick number in the NFL draft}
1820
#' ...
1921
#' }
20-
#' @source \url{http://sports.core.api.espn.com/v2/sports/football/leagues/nfl/seasons/2022/athletes/}
22+
#' @source \url{http://sports.core.api.espn.com/v2/sports/football/leagues/nfl/seasons/2023/athletes/}
2123
"nfl_players"
2224

23-
#' 2022 NFL Teams
25+
#' 2023 NFL Teams
2426
#'
25-
#' The 32 professional NFL teams as of the 2022 season.
27+
#' The 32 professional NFL teams as of the 2023 season.
2628
#'
2729
#' @format A data frame with 33 rows and 6 columns:
2830
#' \describe{
@@ -34,12 +36,12 @@
3436
#' \item{conference}{NFL conference}
3537
#' ...
3638
#' }
37-
#' @source \url{https://fantasy.espn.com/apis/v3/games/ffl/seasons/2022?view=proTeamSchedules_wl}
39+
#' @source \url{https://fantasy.espn.com/apis/v3/games/ffl/seasons/2023?view=proTeamSchedules_wl}
3840
"nfl_teams"
3941

40-
#' 2022 NFL Schedule
42+
#' 2023 NFL Schedule
4143
#'
42-
#' The 2022 NFL season schedule by team, as of September 10th.
44+
#' The 2023 NFL season schedule by team, as of September 10th.
4345
#'
4446
#' @format A data frame with 544 rows and 6 variables:
4547
#' \describe{
@@ -52,5 +54,5 @@
5254
#' \item{date}{Matchup start date and time}
5355
#' ...
5456
#' }
55-
#' @source \url{https://fantasy.espn.com/apis/v3/games/ffl/seasons/2022?view=proTeamSchedules_wl}
57+
#' @source \url{https://fantasy.espn.com/apis/v3/games/ffl/seasons/2023?view=proTeamSchedules_wl}
5658
"nfl_schedule"

R/fflr.R renamed to R/fflr-package.R

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
#'
33
#' The fflr package parses the JSON data returned by the ESPN v3 API into tidy
44
#' data frames for easy analysis. The package also includes data objects for the
5-
#' NFL with players, teams, and the 2022 schedule. The league must first be made
5+
#' NFL with players, teams, and the 2023 schedule. The league must first be made
66
#' viewable to the public by the league manager, which can be done on the basic
77
#' settings page on the ESPN website. Functions can then take the numeric league
88
#' ID found in the URL to return data from the API. This league ID can be set as
99
#' a global option named "fflr.leagueId" with `options()`.
1010
#'
11-
#' @docType package
12-
#' @name fflr
11+
#' @keywords internal
12+
"_PACKAGE"
13+
14+
## usethis namespace: start
15+
## usethis namespace: end
1316
NULL
14-
#> NULL

R/live.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#' @examples
1414
#' live_scoring(leagueId = "42654852", yetToPlay = FALSE)
1515
#' @importFrom tibble tibble
16+
#' @importFrom stats median
1617
#' @family scoring functions
1718
#' @export
1819
live_scoring <- function(leagueId = ffl_id(), yetToPlay = FALSE,

R/outlook.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ player_outlook <- function(leagueId = ffl_id(), limit = 50) {
2020
all_get <- httr::RETRY(
2121
verb = "GET",
2222
url = paste0(
23-
"https://fantasy.espn.com/apis/v3/games/ffl/seasons/2022/segments/0/leagues/",
23+
"https://fantasy.espn.com/apis/v3/games/ffl/seasons/2023/segments/0/leagues/",
2424
leagueId
2525
),
2626
query = list(view = "kona_player_info"),

R/players.R

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ list_players <- function(leagueId = ffl_id(),
7474
verb = "GET",
7575
url = paste0(
7676
"https://fantasy.espn.com",
77-
"/apis/v3/games/ffl/seasons/2022/segments/0/leagues/",
77+
"/apis/v3/games/ffl/seasons/2023/segments/0/leagues/",
7878
leagueId
7979
),
8080
query = list(view = "kona_player_info"),
@@ -260,11 +260,11 @@ fantasy_filter <- function(sort, position, status, injured, scoringPeriodId,
260260
filterStatsForTopScoringPeriodIds = list(
261261
value = U(2),
262262
additionalValue = c(
263-
"002022",
264-
"102022",
263+
"002023",
264+
"102023",
265265
"002020",
266-
paste0("112022", scoringPeriodId),
267-
"022022"
266+
paste0("112023", scoringPeriodId),
267+
"022023"
268268
)
269269
)
270270
)
@@ -314,7 +314,7 @@ filter_sort <- function(sort = "ROST", scoringPeriodId) {
314314
sortAppliedStatTotal = list( # PROJ
315315
sortAsc = FALSE,
316316
sortPriority = 1,
317-
value = paste0("112022", scoringPeriodId)
317+
value = paste0("112023", scoringPeriodId)
318318
),
319319
sortAppliedStatTotalForScoringPeriodId = list( # SCORE
320320
sortAsc = FALSE,
@@ -346,12 +346,12 @@ filter_sort <- function(sort = "ROST", scoringPeriodId) {
346346
sortAppliedStatTotal = list( # FPTS
347347
sortAsc = FALSE,
348348
sortPriority = 1,
349-
value = "002022"
349+
value = "002023"
350350
),
351351
sortAppliedStatAverage = list( # AVG
352352
sortAsc = FALSE,
353353
sortPriority = 1,
354-
value = "002022"
354+
value = "002023"
355355
),
356356
sortAppliedStatTotalForScoringPeriodId = list( # LAST
357357
sortAsc = FALSE,
@@ -400,7 +400,7 @@ player_info <- function(playerId) {
400400
dat <- try_json(
401401
url = paste0(
402402
"http://sports.core.api.espn.com/",
403-
"v2/sports/football/leagues/nfl/seasons/2022/athletes/", playerId
403+
"v2/sports/football/leagues/nfl/seasons/2023/athletes/", playerId
404404
)
405405
)
406406
out <- list(

R/sysdata.rda

2 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)