Thanks for helping make sdvplotR better. Bug reports, data corrections, documentation fixes and new features are all welcome.
Filing an issue
- Use the Bug report template and include a minimal reprex plus
sessionInfo(). - Use the Missing or incorrect team data template for a wrong logo, color, abbreviation or historical mapping. Cite a source (team media guide, league site, ESPN).
- Use the Feature request template for new functionality. Link the equivalent in nflplotR / cfbplotR / nbaplotR / mlbplotR if one exists.
Development setup
# R >= 4.1
install.packages(c("devtools", "roxygen2", "testthat", "pkgdown", "styler", "lintr"))
devtools::load_all()
devtools::test()
devtools::document()
devtools::check()How the package is put together
sdvplotR is a thin domain layer on top of ggpath:
-
R/utils.Rresolves a team abbreviation or player id to an image URL (logo_from_team(),wordmark_from_team(),headshot_from_id(), variant-awareresolve_logo_url()). - Geoms resolve the
team/player_idaesthetic to apathcolumn and delegate rendering toggpath::GeomFromPath$draw_panel(). - Theme elements are plain S3 lists; their
element_grob()methods build a realggpath::element_path()(an S7 object) and hand off to ggplot2. Never re-class a list aselement_path. - gt / reactable helpers emit
<img>tags or inline CSS from the same resolvers. - Team data lives in
R/sysdata.rda(logo_ref,abbr_mapping), built bydata-raw/generate_logo_ref.Rfrom the ESPN team endpoints andnflreadr::load_teams(). Historical / relocated abbreviations are inR/historical_teams.R.
Making changes
- Branch from
main(feat/...,fix/...,docs/...). - Follow the tidyverse style guide; run
styler::style_pkg()on files you touched. - Add or update tests in
tests/testthat/test-<file>.R. Tests must run offline: assert on the resolved URLs / HTML, andskip_on_cran()+skip_if_offline()for anything that renders images. - Every exported function needs roxygen docs with
@param,@returnand@examples. Examples that download images go in\donttest{}. - Run
devtools::document()and commitman/andNAMESPACE; never edit them by hand. -
Team data changes go in
data-raw/generate_logo_ref.R(orR/historical_teams.Rfor relocations), then re-run the script and commit the regeneratedR/sysdata.rda. Never hand-edit the.rda. - Add a bullet to
NEWS.mdfor user-facing changes. - If
README.Rmdchanged, re-render withdevtools::build_readme(). -
devtools::check()should report 0 errors, 0 warnings, 0 notes before you open the pull request.
Commit messages
Use Conventional Commits: feat(geom): ..., fix(gt): ..., data(nhl): ..., docs: ..., test: ..., chore: .... Do not add AI assistants as commit co-authors.
Code of Conduct
This project is released with a Contributor Code of Conduct. By participating you agree to abide by its terms.
