Skip to content

Commit

Permalink
Merge pull request #282 from dynastyprocess/dev
Browse files Browse the repository at this point in the history
CRAN v1.4.2 - small bugfixes
  • Loading branch information
tanho63 authored May 10, 2021
2 parents e1075f0 + 6287a94 commit 3d4579c
Show file tree
Hide file tree
Showing 104 changed files with 256 additions and 214 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: ffscrapr
Title: API Client for Fantasy Football League Platforms
Version: 1.4.1
Version: 1.4.2
Authors@R:
c(person(given = "Tan",
family = "Ho",
Expand Down Expand Up @@ -61,3 +61,4 @@ VignetteBuilder:
knitr
Encoding: UTF-8
RoxygenNote: 7.1.1
Roxygen: list(markdown = TRUE)
15 changes: 15 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# ffscrapr 1.4.2

The main goal of v1.4.2 is to patch some minor bugs.

## Minor changes

- `espn_rosters` now has a `week` argument to return a specific week of data. (Fixes #276, thanks @scottfrechette!)
- `ff_scoringhistory` now tries to return a platform-specific player ID, where available. (Fixes #275)
- Roxygen configured to use markdown (with the roxygen2md package) - hopefully fixes the lifecycle badge issues?
- `sleeper_players()` - gsis_id gets `str_squish` applied to it to resolve some stowaway whitespaces.
- `mfl_players()` - add `any_of` handling for columns to handle column name changes.
- `sleeper_transactions` now handles offseason transactions correctly

---

# ffscrapr 1.4.1

The main goal of v1.4.1 is to patch some issues raised by CRAN checks and also correct some bugs in the new experimental `ff_scoringhistory` and `ff_starter_positions` functions released in v1.4.0.
Expand Down
34 changes: 17 additions & 17 deletions R/0_generics.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
#' @param league_id league_id (currently assuming one league at a time)
#' @param ... other parameters passed to the connect function for each specific platform.
#'
#' @seealso \code{\link{mfl_connect}}, \code{\link{sleeper_connect}}, \code{\link{fleaflicker_connect}}, \code{\link{espn_connect}}
#' @seealso [mfl_connect()], [sleeper_connect()], [fleaflicker_connect()], [espn_connect()]
#'
#' @examples
#' \donttest{
#' ff_connect(platform = "mfl", season = 2019, league_id = 54040, rate_limit = FALSE)
#' }
#' @export ff_connect
#' @return a connection object to be used with \code{ff_*} functions
#' @return a connection object to be used with `ff_*` functions

ff_connect <- function(platform = "mfl", league_id = NULL, ...) {
platform <- tolower(platform)
Expand All @@ -44,7 +44,7 @@ ff_connect <- function(platform = "mfl", league_id = NULL, ...) {
#'
#' This function returns a tidy dataframe of common league settings, including details like "1QB" or "2QB/SF", scoring, best ball, team count, IDP etc. This is potentially useful in summarising the features of multiple leagues.
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#'
#' @export ff_league
#'
Expand All @@ -65,7 +65,7 @@ ff_league.default <- function(conn) {
#'
#' This function returns a dataframe with detailed scoring settings for each league - broken down by event, points, and (if available) position.
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#'
#' @return A tibble of league scoring rules for each position defined.
#' @export
Expand All @@ -85,7 +85,7 @@ ff_scoring.default <- function(conn) {
#'
#' This function returns a tidy dataframe of team rosters
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#' @param ... arguments passed to other methods
#'
#' @return A tidy dataframe of rosters, joined to basic player information and basic franchise information
Expand All @@ -106,7 +106,7 @@ ff_rosters.default <- function(conn, ...) {
#'
#' Return franchise-level data (including divisions, usernames, etc) - available data may vary slightly based on platform.
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#'
#' @return A tidy dataframe of franchises, complete with IDs
#'
Expand All @@ -128,7 +128,7 @@ ff_franchises.default <- function(conn) {
#' This function returns a tidy dataframe of transactions - generally one row per player per transaction per team.
#' Each trade is represented twice, once per each team.
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#' @param ... additional args passed to platform-specific methods
#'
#' @return A tidy dataframe of transaction data
Expand All @@ -151,7 +151,7 @@ ff_transactions.default <- function(conn, ...) {
#' This function gets a tidy dataframe of draft results for the current year.
#' Can handle MFL devy drafts or startup drafts by specifying the custom_players argument
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#' @param ... additional args passed to each platform
#'
#' @return A tidy dataframe of draft results
Expand All @@ -173,7 +173,7 @@ ff_draft.default <- function(conn, ...) {
#'
#' This function returns a tidy dataframe of player scores based on league rules.
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#' @param ... arguments passed to other methods
#'
#' @return A tibble of historical player scoring
Expand All @@ -194,7 +194,7 @@ ff_playerscores.default <- function(conn, season, week, ...) {
#'
#' This function returns a tidy dataframe of season-long fantasy team stats, including H2H wins as well as points, potential points, and all-play.
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#' @param ... additional args passed to platform-specific methods
#'
#' @return A tidy dataframe of standings data
Expand All @@ -216,7 +216,7 @@ ff_standings.default <- function(conn, ...) {
#'
#' Returns all draft picks (current and future) that belong to a specific franchise and have not yet been converted into players (i.e. selected.)
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#' @param ... additional args passed to specific methods
#'
#' @return Returns a dataframe with current and future draft picks for each franchise
Expand All @@ -237,7 +237,7 @@ ff_draftpicks.default <- function(conn, ...) {
#'
#' This function returns a tidy dataframe with one row for every team for every weekly matchup
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#' @param ... additional args passed to each platform
#'
#' @return A tidy dataframe with one row per game per franchise per week
Expand All @@ -258,7 +258,7 @@ ff_schedule.default <- function(conn, ...) {
#'
#' This function returns a tidy dataframe with one row for every league a user is in. This requries authentication cookies for MFL usage.
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#' @param ... additional args passed to specific platform methods
#'
#' @return A tidy dataframe with one row for every league a user is in
Expand All @@ -279,7 +279,7 @@ ff_userleagues.default <- function(conn, ...) {
#'
#' This function returns a tidy dataframe with one row for every starter (and bench) for every week and their scoring, if available.
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#' @param ... additional args depending on method
#'
#' @export ff_starters
Expand All @@ -301,7 +301,7 @@ ff_starters.default <- function(conn, ...) {
#'
#' This function returns a tidy dataframe with positional lineup rules.
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#' @param ... additional args depending on method
#'
#' @return A tidy dataframe of positional lineup rules, one row per position with minimum and maximum starters as well as total starter calculations.
Expand All @@ -324,11 +324,11 @@ ff_starter_positions.default <- function(conn, ...) {
#' (Experimental!) This function reads your league's ff_scoring rules and maps them to nflfastr week-level data.
#' Not all of the scoring rules from your league may have nflfastr equivalents, but most of the common ones are available!
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#' @param season a numeric vector of seasons (earliest available year is 1999, default is 1999:2020)
#' @param ... other arguments
#'
#' @seealso \url{https://www.nflfastr.com/reference/load_player_stats.html}
#' @seealso <https://www.nflfastr.com/reference/load_player_stats.html>
#'
#' @return A tidy dataframe of weekly fantasy scoring data, one row per player per week
#'
Expand Down
8 changes: 4 additions & 4 deletions R/0_helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#'
#' This wrapper on httr retries the httr::GET function based on best-practice heuristics
#'
#' @param ... arguments passed to \code{httr::GET}
#' @param ... arguments passed to `httr::GET`
#'
#' @keywords internal
.retry_get <- function(...) {
Expand All @@ -38,7 +38,7 @@
#'
#' This wrapper on httr retries the httr::POST function based on best-practice heuristics.
#'
#' @param ... arguments passed to \code{httr::POST}
#' @param ... arguments passed to `httr::POST`
#'
#' @keywords internal
.retry_post <- function(...) {
Expand All @@ -51,7 +51,7 @@
#' in the .ffscrapr_env hidden object
#'
#' @param toggle a logical to turn on rate_limiting if TRUE and off if FALSE
#' @param rate_number number of calls per \code{rate_seconds}
#' @param rate_number number of calls per `rate_seconds`
#' @param rate_seconds number of seconds
#'
#' @keywords internal
Expand Down Expand Up @@ -139,7 +139,7 @@
#'
#' @param ... a named cookie values
#'
#' @seealso \code{httr::set_cookies}
#' @seealso `httr::set_cookies`
#'
#' @keywords internal

Expand Down
2 changes: 1 addition & 1 deletion R/0_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ NULL

#' Pipe operator
#'
#' See \code{magrittr::\link[magrittr:pipe]{\%>\%}} for details.
#' See `magrittr::[\%>\%][magrittr::pipe]` for details.
#'
#' @name %>%
#' @rdname pipe
Expand Down
6 changes: 3 additions & 3 deletions R/1_import_dp.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#'
#' Fetches a copy of the latest DynastyProcess dynasty trade values sheets
#'
#' @param file one of \code{c("values.csv","values-players.csv","values-picks.csv")}
#' @param file one of `c("values.csv","values-players.csv","values-picks.csv")`
#'
#' @seealso \url{https://github.com/DynastyProcess/data}
#' @seealso <https://github.com/DynastyProcess/data>
#'
#' @examples
#' \donttest{
Expand Down Expand Up @@ -45,7 +45,7 @@ dp_values <- function(file = c("values.csv", "values-players.csv", "values-picks
#' dp_playerids()
#' }
#'
#' @seealso \url{https://github.com/DynastyProcess/data}
#' @seealso <https://github.com/DynastyProcess/data>
#'
#' @return a tibble of player IDs
#'
Expand Down
6 changes: 3 additions & 3 deletions R/1_import_nflfastr.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#'
#' @param type One of "offense", "defense", or "all" - currently, only "offense" is available.
#'
#' @seealso \url{https://www.nflfastr.com/reference/load_player_stats.html}
#' @seealso <https://www.nflfastr.com/reference/load_player_stats.html>
#'
#' @examples
#' \donttest{
Expand Down Expand Up @@ -52,7 +52,7 @@ nflfastr_weekly <- function(type = c("offense", "defense", "all")) {
#'
#' @param seasons A numeric vector of seasons, earliest of which is 1999
#'
#' @seealso \url{https://www.nflfastr.com/reference/fast_scraper_roster.html}
#' @seealso <https://www.nflfastr.com/reference/fast_scraper_roster.html>
#'
#' @examples
#' \donttest{
Expand Down Expand Up @@ -94,7 +94,7 @@ nflfastr_rosters <- function(seasons) {
#'
#' @param raw raw-content that is known to be an RDS file
#'
#' @seealso \code{httr::set_cookies}
#' @seealso `httr::set_cookies`
#'
#' @keywords internal

Expand Down
10 changes: 5 additions & 5 deletions R/espn__helpers.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#' ESPN Lineup Slot map
#'
#' This is for the starting lineup specifically - primary positions is accessible via \code{.espn_pos_map}
#' This is for the starting lineup specifically - primary positions is accessible via `.espn_pos_map`
#'
#' @keywords internal
#' @seealso \url{https://github.com/cwendt94/espn-api/blob/master/espn_api/football/constant.py}
#' @seealso <https://github.com/cwendt94/espn-api/blob/master/espn_api/football/constant.py>
.espn_lineupslot_map <- function() {
c(
"0" = "QB",
Expand Down Expand Up @@ -107,7 +107,7 @@
#' Abbreviations are consistently three letters.
#'
#' @keywords internal
#' @seealso \url{https://github.com/cwendt94/espn-api/blob/master/espn_api/football/constant.py}
#' @seealso <https://github.com/cwendt94/espn-api/blob/master/espn_api/football/constant.py>
.espn_team_map <- function() {
c(
"0" = "FA",
Expand Down Expand Up @@ -183,7 +183,7 @@
#' ESPN Stat ID map
#'
#' @keywords internal
#' @seealso \url{https://github.com/cwendt94/espn-api/blob/master/espn_api/football/constant.py}
#' @seealso <https://github.com/cwendt94/espn-api/blob/master/espn_api/football/constant.py>
.espn_stat_map <- function() {
c(
"3" = "passingYards",
Expand Down Expand Up @@ -268,7 +268,7 @@
#'
#' @keywords internal
#'
#' @seealso \url{https://github.com/cwendt94/espn-api/blob/master/espn_api/football/constant.py#L82-92}
#' @seealso <https://github.com/cwendt94/espn-api/blob/master/espn_api/football/constant.py#L82-92>

.espn_activity_map <- function() {
c(
Expand Down
10 changes: 5 additions & 5 deletions R/espn_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
#'
#' Please see the vignette for more on usage.
#'
#' @param conn a connection object created by \code{espn_connect} or \code{ff_connect()}
#' @param conn a connection object created by `espn_connect` or `ff_connect()`
#' @param ... Arguments which will be passed as "argumentname = argument" in an HTTP query parameter
#' @param x_fantasy_filter a JSON-encoded character string that specifies a filter for the data
#'
#' @seealso \code{vignette("espn_getendpoint")}
#' @seealso \code{espn_getendpoint_raw}
#' @seealso `vignette("espn_getendpoint")`
#' @seealso `espn_getendpoint_raw`
#'
#' @return A list object containing the query, response, and parsed content.
#' @export
Expand Down Expand Up @@ -72,8 +72,8 @@ espn_getendpoint <- function(conn, ..., x_fantasy_filter = NULL) {
#' @param url_query a fully-formed URL to call
#' @param ... any headers or other httr request objects to pass along
#'
#' @seealso \code{espn_getendpoint()} - a higher level wrapper that checks JSON and prepares the url query
#' @seealso \code{vignette("espn_getendpoint")}
#' @seealso `espn_getendpoint()` - a higher level wrapper that checks JSON and prepares the url query
#' @seealso `vignette("espn_getendpoint")`
#'
#' @return object of class espn_api with parsed content, request, and response
#'
Expand Down
2 changes: 1 addition & 1 deletion R/espn_connect.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#' @param swid SWID parameter for accessing private leagues - see vignette for details
#' @param espn_s2 ESPN_S2 parameter for accessing private leagues - see vignette for details
#' @param rate_limit TRUE by default - turn off rate limiting with FALSE
#' @param rate_limit_number number of calls per \code{rate_limit_seconds}, suggested is under 1000 calls per 60 seconds
#' @param rate_limit_number number of calls per `rate_limit_seconds`, suggested is under 1000 calls per 60 seconds
#' @param rate_limit_seconds number of seconds as denominator for rate_limit
#' @param ... other arguments (for other methods, for R compat)
#'
Expand Down
2 changes: 1 addition & 1 deletion R/espn_draft.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#' Get Draft Results
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#' @param ... args for other methods
#'
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion R/espn_draftpicks.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#' ESPN Draft Picks
#'
#' @param conn the list object created by \code{ff_connect()}
#' @param conn the list object created by `ff_connect()`
#' @param ... other arguments (currently unused)
#'
#' @describeIn ff_draftpicks ESPN: does not support future/draft pick trades - for draft results, please use ff_draft.
Expand Down
2 changes: 1 addition & 1 deletion R/espn_franchises.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#' Get a dataframe of franchise information
#'
#' @param conn a conn object created by \code{ff_connect()}
#' @param conn a conn object created by `ff_connect()`
#'
#' @examples
#' \donttest{
Expand Down
2 changes: 1 addition & 1 deletion R/espn_league.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#' Get a summary of common league settings
#'
#' @param conn the connection object created by \code{ff_connect()}
#' @param conn the connection object created by `ff_connect()`
#'
#' @examples
#' \donttest{
Expand Down
2 changes: 1 addition & 1 deletion R/espn_players.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#' A cached table of ESPN NFL players. Will store in memory for each session!
#' (via memoise in zzz.R)
#'
#' @param conn a connection object created by \code{espn_connect} or \code{ff_connect()}
#' @param conn a connection object created by `espn_connect` or `ff_connect()`
#' @param season a season to fetch
#'
#' @examples
Expand Down
Loading

0 comments on commit 3d4579c

Please sign in to comment.