Skip to content

Commit

Permalink
CRAN 1.4.0 (#211)
Browse files Browse the repository at this point in the history
Closes #209
  • Loading branch information
tanho63 authored Sep 5, 2023
1 parent dd7109d commit fee4b8a
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 112 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: nflreadr
Title: Download 'nflverse' Data
Version: 1.3.2.11
Version: 1.4.0
Authors@R: c(
person("Tan", "Ho", , "[email protected]", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0001-8388-5155")),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ S3method(print,nflverse_sitrep)
export(.clear_cache)
export(.for_cran)
export(.sitrep)
export(as.nflverse_data)
export(clean_homeaway)
export(clean_player_names)
export(clean_team_abbrs)
Expand Down
45 changes: 31 additions & 14 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,39 @@
# nflreadr (development version)
# nflreadr 1.4.0

## Changes
This release addresses bugs, improves some utilities, and adds a few new datasets.

## New Datasets

- `load_player_stats(stat_type = "defense")` added to provide defensive player stats
as computed by `nflfastR::calculate_player_stats_def()` (#200) It also comes with
a data dictionary, courtesy of @mpcen (#192)
- `load_ftn_charting()` adds manual charting data for 2022-onwards, graciously
provided by [FTN Data](https://www.ftndata.com/). This should automatically be updated when published
by FTN, and the early indication is that it will be within 48 hours after a game
has finished.

## Function Improvements

- `nflverse_sitrep()` and friends overhauled:
- now returns a list of sitrep attributes rather than only printing to console (for programmatic use)
- now checks CRAN and r-universe to tell you if your installation is behind cran or devel
- now handles dependencies for nflverse/ffverse packages that are not on CRAN
- `nflreadr::most_recent_season()` and aliases `get_latest_season`, `get_current_season`
etc now use March 15th as the changeover for league year. Hopefully this is not
a moving target 🙃 (1.3.2.01)
- `nflreadr::clean_homeaway()` now handles columns with suffixes `_home` and `_away` (1.3.2.02)
- `nflreadr::most_recent_season(roster = TRUE)` and aliases `get_latest_season`, `get_current_season`
etc falsely returned last season after March 15th early in the month. (1.3.2.03)
a moving target 🙃
- `nflreadr::clean_homeaway()` now handles columns with suffixes `_home` and `_away`
- `nflreadr::nflverse_game_id()` now accepts old team abbreviations and outputs useful errors.
- Added `.for_cran()` to limit parallelization in CRAN examples and tests
- `make_nflverse_data_class()` now uses `data.table::setattr()` to preserve data.table pointer

## Dictionary updates
- Clarified description of the `"special"` variable in the play-by-play data dictionary. (1.3.2.04) (#189)
- `nflreadr::nflverse_game_id()` accepts old team abbreviations and outputs useful errors. (1.3.2.05) (#191)
- Added `dictionary_player_stats_def` (thank you @mpcen!) (1.3.2.06) (#192)
- Added `.for_cran()` to limit parallelization in CRAN examples and tests (1.3.2.07)
- `nflverse_sitrep()` and friends now return a list of sitrep attributes instead of just printing to console.
- `make_nflverse_data_class()` now uses `data.table::setattr()` to set attributes and retain data.table pointer (v1.3.2.08)
- `nflreadr::load_player_stats()` now accepts `stat_type = "defense"` and loads defensive player stats computed with `nflfastR::calculate_player_stats_def()`. (v1.3.2.09) (#200)
- `nflverse_sitrep()` and friends now check CRAN and r-universe versions of packages (v1.3.2.10) (#206)
- `load_ftn_charting()` adds charting data provided by FTNData.com (v1.3.2.11)


Thank you to [@ak47twq](https://github.com/ak47twq), [@alecglen](https://github.com/alecglen), [@andycancapital](https://github.com/andycancapital), [@bullaspc](https://github.com/bullaspc), [@mcarman8](https://github.com/mcarman8), [@mpcen](https://github.com/mpcen), [@mrcaseb](https://github.com/mrcaseb), [@tanho63](https://github.com/tanho63), [@tashapiro](https://github.com/tashapiro), and [@TheMathNinja](https://github.com/TheMathNinja)
for their questions, feedback, and contributions to this release

--

# nflreadr 1.3.2

Expand Down
2 changes: 1 addition & 1 deletion R/load_ftn_charting.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#'
#' @return Precomputed expected fantasy points data from the ffopportunity automated releases.
#'
#' @seealso <https://ftndata.com>
#' @seealso <https://www.ftndata.com>
#' @seealso `vignette("Data Dictionary - FTN Charting")`
#' @seealso <https://nflreadr.nflverse.com/articles/dictionary_ftn_charting.html> for the web data dictionary
#' @family ftn_charting
Expand Down
7 changes: 6 additions & 1 deletion R/utils_nflverse_data_class.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ print.nflverse_data <- function(x,...){
invisible(x)
}

make_nflverse_data <- function(df, nflverse_type = NULL, ...){
#' @export
#' @aliases make_nflverse_data
#' @rdname nflverse_data-class
as.nflverse_data <- function(df, nflverse_type = NULL, ...){

df <- data.table::as.data.table(df)
data.table::setattr(df, "class", c("nflverse_data", "tbl_df", "tbl", "data.table","data.frame"))
Expand All @@ -47,3 +50,5 @@ make_nflverse_data <- function(df, nflverse_type = NULL, ...){

return(df)
}

make_nflverse_data <- as.nflverse_data
11 changes: 6 additions & 5 deletions R/utils_sitrep.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ ffverse_sitrep <- function(pkg = c("ffscrapr", "ffsimulator", "ffpros", "ffoppor
)
]



return(as.data.frame(inst))
}

Expand Down Expand Up @@ -194,13 +196,12 @@ print.nflverse_sitrep <- function(x, ...) {
cli::cat_bullet(glue::glue("{x$system_info$r_version} {cli::symbol$bullet} Running under: {x$system_info$os_version}")) # nolint

cli::cat_rule(cli::style_bold("Package Status"), col = cli::make_ansi_style("cyan"), line = 1)
pkg_status <- x$installed
rownames(pkg_status) <- pkg_status$package
pkg_status$package <- NULL
print(pkg_status)
if(nrow(x$installed) > 0) {
print(x$installed)
}

cli::cat_rule(cli::style_bold("Package Options"), col = cli::make_ansi_style("cyan"), line = 1)
if (length(x$package_options) == 0) cli::cli_bullets("No options set for above packages")
if (length(x$package_options) == 0) cli::cat_bullet("No options set for above packages")
if (length(x$package_options) > 0) .cat_options(names(x$package_options), unname(x$package_options))

if (length(x$dependencies) >= 1) {
Expand Down
71 changes: 33 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,51 +61,46 @@ library(nflreadr)

load_pbp(2021)
#> ── nflverse play by play data ──────────────────────────────────────────────────
#> ℹ Data updated: 2022-09-27 07:35:02 EDT
#> ℹ Data updated: 2022-09-27 04:35:02 PDT
#> # A tibble: 50,712 × 372
#> play_id game_id old_g…¹ home_…² away_…³ seaso…⁴ week posteam poste…⁵ defteam
#> <dbl> <chr> <chr> <chr> <chr> <chr> <int> <chr> <chr> <chr>
#> 1 1 2021_0… 202109… TEN ARI REG 1 <NA> <NA> <NA>
#> 2 40 2021_0… 202109… TEN ARI REG 1 TEN home ARI
#> 3 55 2021_0… 202109… TEN ARI REG 1 TEN home ARI
#> 4 76 2021_0… 202109… TEN ARI REG 1 TEN home ARI
#> 5 100 2021_0… 202109… TEN ARI REG 1 TEN home ARI
#> 6 122 2021_0… 202109… TEN ARI REG 1 TEN home ARI
#> 7 152 2021_0… 202109… TEN ARI REG 1 ARI away TEN
#> 8 181 2021_0… 202109… TEN ARI REG 1 ARI away TEN
#> 9 218 2021_0… 202109… TEN ARI REG 1 ARI away TEN
#> 10 253 2021_0… 202109… TEN ARI REG 1 ARI away TEN
#> # … with 50,702 more rows, 362 more variables: side_of_field <chr>,
#> play_id game_id old_game_id home_team away_team season_type week posteam
#> <dbl> <chr> <chr> <chr> <chr> <chr> <int> <chr>
#> 1 1 2021_01_AR… 2021091207 TEN ARI REG 1 <NA>
#> 2 40 2021_01_AR… 2021091207 TEN ARI REG 1 TEN
#> 3 55 2021_01_AR… 2021091207 TEN ARI REG 1 TEN
#> 4 76 2021_01_AR… 2021091207 TEN ARI REG 1 TEN
#> 5 100 2021_01_AR… 2021091207 TEN ARI REG 1 TEN
#> 6 122 2021_01_AR… 2021091207 TEN ARI REG 1 TEN
#> 7 152 2021_01_AR… 2021091207 TEN ARI REG 1 ARI
#> 8 181 2021_01_AR… 2021091207 TEN ARI REG 1 ARI
#> 9 218 2021_01_AR… 2021091207 TEN ARI REG 1 ARI
#> 10 253 2021_01_AR… 2021091207 TEN ARI REG 1 ARI
#> # ℹ 50,702 more rows
#> # ℹ 364 more variables: posteam_type <chr>, defteam <chr>, side_of_field <chr>,
#> # yardline_100 <dbl>, game_date <chr>, quarter_seconds_remaining <dbl>,
#> # half_seconds_remaining <dbl>, game_seconds_remaining <dbl>,
#> # game_half <chr>, quarter_end <dbl>, drive <dbl>, sp <dbl>, …, and
#> # abbreviated variable names ¹​old_game_id, ²​home_team, ³​away_team,
#> # ⁴​season_type, ⁵​posteam_type
#> # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
#> # game_half <chr>, quarter_end <dbl>, …

load_player_stats(2021)
#> ── nflverse player stats: offense ──────────────────────────────────────────────
#> ℹ Data updated: 2023-01-05 04:08:21 EST
#> ℹ Data updated: 2023-02-28 01:26:47 PST
#> # A tibble: 5,698 × 52
#> player…¹ playe…² playe…³ posit…⁴ posit…⁵ heads…⁶ recen…⁷ season week seaso…⁸
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <int> <int> <chr>
#> 1 00-0019… T.Brady Tom Br… QB QB https:… TB 2021 1 REG
#> 2 00-0019… T.Brady Tom Br… QB QB https:… TB 2021 2 REG
#> 3 00-0019… T.Brady Tom Br… QB QB https:… TB 2021 3 REG
#> 4 00-0019… T.Brady Tom Br… QB QB https:… TB 2021 4 REG
#> 5 00-0019… T.Brady Tom Br… QB QB https:… TB 2021 5 REG
#> 6 00-0019… T.Brady Tom Br… QB QB https:… TB 2021 6 REG
#> 7 00-0019… T.Brady Tom Br… QB QB https:… TB 2021 7 REG
#> 8 00-0019… T.Brady Tom Br… QB QB https:… TB 2021 8 REG
#> 9 00-0019… T.Brady Tom Br… QB QB https:… TB 2021 10 REG
#> 10 00-0019… T.Brady Tom Br… QB QB https:… TB 2021 11 REG
#> # … with 5,688 more rows, 42 more variables: completions <int>, attempts <int>,
#> # passing_yards <dbl>, passing_tds <int>, interceptions <dbl>, sacks <dbl>,
#> # sack_yards <dbl>, sack_fumbles <int>, sack_fumbles_lost <int>,
#> # passing_air_yards <dbl>, …, and abbreviated variable names ¹​player_id,
#> # ²​player_name, ³​player_display_name, ⁴​position, ⁵​position_group,
#> # ⁶​headshot_url, ⁷​recent_team, ⁸​season_type
#> # ℹ Use `print(n = ...)` to see more rows, and `colnames()` to see all variable names
#> player_id player_name player_display_name position position_group
#> <chr> <chr> <chr> <chr> <chr>
#> 1 00-0019596 T.Brady Tom Brady QB QB
#> 2 00-0019596 T.Brady Tom Brady QB QB
#> 3 00-0019596 T.Brady Tom Brady QB QB
#> 4 00-0019596 T.Brady Tom Brady QB QB
#> 5 00-0019596 T.Brady Tom Brady QB QB
#> 6 00-0019596 T.Brady Tom Brady QB QB
#> 7 00-0019596 T.Brady Tom Brady QB QB
#> 8 00-0019596 T.Brady Tom Brady QB QB
#> 9 00-0019596 T.Brady Tom Brady QB QB
#> 10 00-0019596 T.Brady Tom Brady QB QB
#> # ℹ 5,688 more rows
#> # ℹ 47 more variables: headshot_url <chr>, recent_team <chr>, season <int>,
#> # week <int>, season_type <chr>, completions <int>, attempts <int>,
#> # passing_yards <dbl>, passing_tds <int>, interceptions <dbl>, …
```

## Data Sources
Expand Down
16 changes: 8 additions & 8 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
## SUBMISSION

Resolves test failure.
This release addresses bugs, improves some utilities, and adds a few new datasets.

## Test environments
* local windows R installation, R 4.2.0
* windows (on GitHub Actions), R 4.2.1
* macOS (on GitHub Actions), R 4.2.1
* ubuntu 20.04 (on GitHub Actions), R 4.2.1
* ubuntu 20.04 (on GitHub Actions), R 3.6.0
* ubuntu 20.04 (on GitHub Actions), R devel
* local windows R installation, R 4.3.0
* windows (on GitHub Actions), R 4.3.1
* macOS (on GitHub Actions), R 4.3.1
* ubuntu 22.04 (on GitHub Actions), R 4.3.1
* ubuntu 22.04 (on GitHub Actions), R 3.6.0
* ubuntu 22.04 (on GitHub Actions), R devel

## R CMD check results

0 errors | 0 warnings | 0 note

## Reverse dependencies

We checked 7 reverse dependencies (7 from CRAN + 0 from Bioconductor),
We checked 9 reverse dependencies (7 from CRAN, 2 from r-universe, 0 from Bioconductor),
comparing R CMD check results across CRAN and dev versions of this package.

* We saw 0 new problems
Expand Down
2 changes: 1 addition & 1 deletion man/load_ftn_charting.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions man/nflverse_data-class.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

52 changes: 10 additions & 42 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ home:
navbar:
bg: dark
structure:
left: [home, reference, dictionaries, articles, news]
left: [home, reference, articles, news]
right: [discord, github, more]
components:
discord:
Expand All @@ -93,48 +93,8 @@ navbar:
text: "Functions"
href: reference/index.html
articles:
text: "Vignettes"
text: "Articles & Dictionaries"
href: articles/index.html
dictionaries:
text: "Dictionaries"
menu:
- text: Play by Play
href: articles/dictionary_pbp.html
- text: Player Stats
href: articles/dictionary_player_stats.html
- text: Participation
href: articles/dictionary_participation.html
- text: Rosters
href: articles/dictionary_rosters.html
- text: Schedules
href: articles/dictionary_schedules.html
- text: Snap Counts
href: articles/dictionary_snap_counts.html
- text: Fantasy Player IDs
href: articles/dictionary_ff_playerids.html
- text: Fantasy Rankings
href: articles/dictionary_ff_rankings.html
- text: Next Gen Stats
href: articles/dictionary_nextgen_stats.html
- text: PFR Advanced Stats
href: articles/dictionary_pfr_passing.html
- text: Draft Picks
href: articles/dictionary_draft_picks.html
- text: ESPN QBR
href: articles/dictionary_espn_qbr.html
- text: Combine
href: articles/dictionary_combine.html
- text: Injuries
href: articles/dictionary_injuries.html
- text: Depth Charts
href: articles/dictionary_depth_charts.html
- text: Trades
href: articles/dictionary_trades.html
- text: Contracts
href: articles/dictionary_contracts.html
- text: FTN Charting
href: articles/dictionary_ftn_charting.html

more:
text: "Packages & More"
menu:
Expand All @@ -158,6 +118,14 @@ navbar:
- text: "ffverse.com"
href: https://www.ffverse.com

articles:
- title: Dictionaries
contents: starts_with("dictionary")
- title: Other
contents:
- "articles/nflverse_data_schedule"
- "exporting_nflreadr"

template:
bootstrap: 5
params:
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-utils_sitrep.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("sitrep works", {
skip_on_cran()
nflreadr_sitrep <- .sitrep("nflreadr", recursive = FALSE)
nflreadr_sitrep <- .sitrep(c("nflreadr","data.table"), recursive = FALSE)
expect_named(
nflreadr_sitrep,
c("system_info", "installed", "dependencies", "package_options",
Expand Down

0 comments on commit fee4b8a

Please sign in to comment.