fix(fg): honor startdate/enddate date ranges (#326) + doc/check maintenance sweep - #414
Merged
Conversation
FanGraphs only applies startdate/enddate when month = "1000"; with the default month = "0" the leaders API silently returns the full-season board. The six leaderboard/team wrappers now set month <- "1000" when a date range is requested without an explicit month, and the @PARAM month docs cover the special values ("13" vs LHP, "14" vs RHP, "1000" date range). Verified live: 2023-03-26..2023-04-26 returns the date-ranged board (947 rows, max PA 118, identical to explicit month = "1000") instead of the full season (1457 rows, max PA 753); gated regression test added.
…lendar The shim documents its only parameter (season) locally, so @inheritParams espn_mlb_calendar had nothing left to inherit and roxygen2 errored with "@inheritParams failed" on every devtools::document() run.
.omc, .understand-anything, R/.omc, and R/.ruff_cache are local tooling droppings that R CMD check flags as non-standard package files.
…ilot instructions
Drop the trailing slash from the 404ing stargazers badge link and point NEWS.md at the current https/redirect targets (stats.ncaa.org, Stathead).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Summary
fg_batter_leaders(),fg_pitcher_leaders(),fg_fielder_leaders(),fg_team_batter(),fg_team_pitcher(), andfg_team_fielder()now honorstartdate/enddateout of the box, plus a maintenance sweep: a roxygen@inheritParamsfailure fix, R CMD check NOTE cleanups, and CLAUDE.md / Copilot-instruction updates.Type of Change
fix-- Bug fix (non-breaking change that fixes an issue)docs-- Documentation only (roxygen, README, vignettes, NEWS)test-- Adding or updating testschore-- Tooling, build, or maintenance changeRelated Issues
Fixes #326.
Background & Context
FanGraphs' leaders API treats
monthas a modal parameter, not just a calendar month:startdate/enddateare only applied whenmonth = "1000". With the defaultmonth = "0", a date-ranged call silently returned the full-season board — no error, just wrong data (#326).Changes Made
fix(fg): the six leaderboard/team wrappers auto-setmonth <- "1000"when a date range is supplied andmonthwas left at its default (""/"0"). An explicitmonthis never overridden. The@param monthdocs now cover the special values ("13"vs LHP,"14"vs RHP,"1000"date range).docs(espn): dropped the failing@inheritParams espn_mlb_calendarfromespn_college_baseball_calendar()— its only parameter (season) is documented locally, so roxygen2 errored with@inheritParams failedon everydevtools::document()run.chore:.Rbuildignore/.gitignoreentries for local AI/tooling cache dirs that R CMD check flags as non-standard files.docs: fixed the URLs flagged by the CRAN-feasibility NOTE (404ing stargazers badge link; http→https / moved targets in NEWS.md), and documented the modalmonthgotcha inCLAUDE.md+.github/copilot-instructions.mdso new date-accepting FanGraphs wrappers apply the same guard.Submission Checklist
devtools::document()run (man pages regenerated, no roxygen warnings)NEWS.mdupdatedTesting
Verified live (2026-07-23), plus a gated regression test in
test-fg_batter_leaders.R(FANGRAPHS_TESTS=1):fg_batter_leaders(startdate = "2023-03-26", enddate = "2023-04-26")(auto)month = "1000"fg_batter_leaders(startseason = "2023", endseason = "2023")The auto and explicit calls are identical; before this fix the date-ranged call returned the full-season board (max PA 753).
Baseline
rcmdcheck --as-cranon master: 0 errors / 0 warnings / 2 notes — both notes addressed here (hidden tooling dirs; invalid URLs). All 5test-fg_batter_leaders.Rtests pass live.Additional Notes
Part of a maintenance sweep that also merged #412 (Savant
miss_distance, fixing #408 + #413) and closed #405 (superseded — the okhttp-UA fix already landed on master with credit) and stale-fixed issues #306, #330, #336, #348, #360, #364, #375.