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. Include what
sdv_teams(),sdv_resolve()orsdv_team_colors()return and 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::document()
devtools::test()
devtools::check(args = "--as-cran")sdv_surface() needs ‘sportyR’ 2.4.5 or later (install.packages("sportyR")).
How the package is put together
sdvplotR is a domain layer on top of ggpath:
- Team data comes from two shared artifacts: the SportsDataverse team index (teams and their aliases across 18 id systems, the same index sdvplot and the JavaScript packages read) and the sdv-assets logo manifest (every archived logo and wordmark by team, variant and season).
R/index.Rreads both from the SportsDataverse CDN and caches them for a day;R/sysdata.rdaholds a bundled snapshot for offline use and CRAN checks (options(sdvplotR.offline = TRUE)). - Every function that takes a team takes a
league(one of the 49 leagues ofsdv_leagues()) and anid_system; those that draw marks or colors also take aseason. All of them resolve teams throughresolve_ids()(R/resolve.R, behindsdv_resolve()), so aliases, id systems and codes reused across eras apply everywhere. Don’t add per-function cleaning. -
mark_url()/select_mark()(R/marks.R) pick a logo or wordmark by variant and season;headshot_from_id()(R/utils.R) builds player headshot URLs forid_system = "espn","gsis"or"league". - Geoms (
geom_sdv_logos(),geom_sdv_wordmarks(),geom_sdv_headshots()) set apathcolumn and delegate rendering toggpath::GeomFromPath$draw_panel(). - Theme elements (
element_sdv_logo()and friends,R/theme_elements.R) are S7 subclasses ofggpath::element_path. Never re-class a plain list aselement_path. - The gt, reactable, plotly, ggiraph and leaflet helpers emit
<img>tags, inline CSS or layout images from the same resolvers. The genericgttoolkit ported from gtUtils (gt_theme_*(), legends, cut lines, save/crop helpers) works on any table and takes noleague. -
sdv_surface()draws 59 playing-surface keys through ‘sportyR’’s exported functions only.
Making changes
- Branch from
main(feat/...,fix/...,docs/...). - Follow the tidyverse style guide. Run
styler::style_file()on files you add; styler rewrites the repo’s double-indented function signatures in existing files (seeCLAUDE.md, Formatting).lintr::lint_package()should report no lints. - Add or update tests in
tests/testthat/test-<file>.R. Every test file starts withskip_on_cran(). Tests run offline (tests/testthat/setup.RsetssdvplotR.offline): assert on the resolved URLs / HTML, and addskip_if_offline()for anything that renders images. - Every exported function needs roxygen docs with
@param,@returnand@examples. Examples that download images go in\donttest{}; never use\dontrun{}. - Run
devtools::document()and commitman/andNAMESPACE; never edit them by hand. List new exported topics in_pkgdown.ymland runpkgdown::check_pkgdown(). -
Team data (logos, colors, aliases, relocations) is fixed upstream in sdv-assets and the sdvplot team index, not here. To refresh the bundled snapshot, run
python data-raw/export_index.pyand thenRscript data-raw/build_index_snapshot.Rfrom the package root. Never hand-editR/sysdata.rda. - Add a bullet to
NEWS.mdfor user-facing changes. - If
README.Rmdchanged, re-render withdevtools::build_readme(). -
devtools::check(args = "--as-cran")should report 0 errors, 0 warnings and 0 notes (a “New submission” note aside) before you open the pull request.
Commit messages
Use Conventional Commits: feat(geom): ..., fix(gt): ..., data(nhl): ..., docs: ..., test: ..., chore: ..., ci: .... 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.
