{"id":31617335,"url":"https://github.com/billpetti/baseballr","last_synced_at":"2025-10-06T12:57:38.087Z","repository":{"id":41966355,"uuid":"48993833","full_name":"BillPetti/baseballr","owner":"BillPetti","description":"A package written for R focused on baseball analysis. Currently in development.","archived":false,"fork":false,"pushed_at":"2025-06-02T15:27:15.000Z","size":32574,"stargazers_count":393,"open_issues_count":83,"forks_count":105,"subscribers_count":48,"default_branch":"master","last_synced_at":"2025-09-27T22:25:23.322Z","etag":null,"topics":["baseball","pitchfx","r","sabermetrics","statcast"],"latest_commit_sha":null,"homepage":"billpetti.github.io/baseballr","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BillPetti.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-01-04T11:49:06.000Z","updated_at":"2025-09-17T01:58:41.000Z","dependencies_parsed_at":"2023-12-25T09:43:46.492Z","dependency_job_id":"533c5b8b-36de-4959-ac7f-9af461dab8e9","html_url":"https://github.com/BillPetti/baseballr","commit_stats":{"total_commits":574,"total_committers":23,"mean_commits":"24.956521739130434","dds":0.3571428571428571,"last_synced_commit":"1758bf8a3fd31e6ee380da677e6e27e14ff6c8b2"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/BillPetti/baseballr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BillPetti%2Fbaseballr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BillPetti%2Fbaseballr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BillPetti%2Fbaseballr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BillPetti%2Fbaseballr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BillPetti","download_url":"https://codeload.github.com/BillPetti/baseballr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BillPetti%2Fbaseballr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278614466,"owners_count":26015967,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["baseball","pitchfx","r","sabermetrics","statcast"],"created_at":"2025-10-06T12:57:36.897Z","updated_at":"2025-10-06T12:57:38.081Z","avatar_url":"https://github.com/BillPetti.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n```{r readme_setup, include = FALSE}\n# You can install using the pacman package using the following code:\nif (!requireNamespace('pacman', quietly = TRUE)){\n  install.packages('pacman')\n}\n\npacman::p_load(dplyr)\n```\n\n# \n\n# `baseballr` \u003ca href='https://billpetti.github.io/baseballr/'\u003e\u003cimg src='https://raw.githubusercontent.com/billpetti/baseballr/master/logo.png' align=\"right\" width=\"30%\" min-width=\"100px\" /\u003e\u003c/a\u003e\n\n\u003c!-- badges: start --\u003e\n\n[![CRAN\nversion](https://img.shields.io/badge/dynamic/json?style=for-the-badge\u0026color=success\u0026label=CRAN%20version\u0026prefix=v\u0026query=%24.Version\u0026url=https%3A%2F%2Fcrandb.r-pkg.org%2Fbaseballr)](https://CRAN.R-project.org/package=baseballr)\n[![CRAN\ndownloads](https://img.shields.io/badge/dynamic/json?style=for-the-badge\u0026color=success\u0026label=Downloads\u0026query=%24%5B0%5D.downloads\u0026url=https%3A%2F%2Fcranlogs.r-pkg.org%2Fdownloads%2Ftotal%2F2021-10-26%3Alast-day%2Fbaseballr)](https://CRAN.R-project.org/package=baseballr)\n[![Version-Number](https://img.shields.io/github/r-package/v/BillPetti/baseballr?label=baseballr\u0026logo=R\u0026style=for-the-badge)](https://github.com/BillPetti/baseballr/)\n[![R-CMD-check](https://img.shields.io/github/actions/workflow/status/BillPetti/baseballr/R-CMD-check.yaml?branch=master\u0026label=R-CMD-Check\u0026logo=R\u0026logoColor=white\u0026style=for-the-badge)](https://github.com/BillPetti/baseballr/actions/workflows/R-CMD-check.yaml)\n[![Lifecycle:maturing](https://img.shields.io/badge/lifecycle-maturing-blue.svg?style=for-the-badge\u0026logo=github)](https://github.com/BillPetti/baseballr/)\n[![Contributors](https://img.shields.io/github/contributors/BillPetti/baseballr?style=for-the-badge)](https://github.com/BillPetti/baseballr/graphs/contributors)\n\u003c!-- badges: end --\u003e\n\n`baseballr` is a package written for R focused on baseball analysis. It\nincludes functions for scraping various data from websites, such as\n[FanGraphs.com](https://www.fangraphs.com/), [Baseball-Reference.com](https://www.baseball-reference.com/), and [baseballsavant.mlb.com](https://baseballsavant.mlb.com/). It also\nincludes functions for calculating metrics, such as wOBA, FIP, and\nteam-level consistency over custom time frames.\n\nYou can read more about some of the functions and how to use them at its\n[official site](https://billpetti.github.io/baseballr/) as well as this\n[Hardball Times\narticle](https://tht.fangraphs.com/developing-the-baseballr-package-for-r/).\n\n## Installation\n\nYou can install the CRAN version of\n[**`baseballr`**](https://CRAN.R-project.org/package=baseballr)\nwith:\n\n``` r\ninstall.packages(\"baseballr\")\n```\n\nYou can install the released version of [**```baseballr```**](https://github.com/BillPetti/baseballr) from [GitHub](https://github.com/BillPetti/baseballr) with:\n\n``` r\n# You can install using the pacman package using the following code:\nif (!requireNamespace('pacman', quietly = TRUE)){\n  install.packages('pacman')\n}\npacman::p_load_current_gh(\"BillPetti/baseballr\")\n```\n\n``` r\n# Alternatively, using the devtools package:\nif (!requireNamespace('devtools', quietly = TRUE)){\n  install.packages('devtools')\n}\ndevtools::install_github(repo = \"BillPetti/baseballr\")\n```\n\nFor experimental functions in development, you can install the [development branch](https://github.com/BillPetti/baseballr/tree/development_branch):\n\n``` r\n# install.packages(\"devtools\")\ndevtools::install_github(\"BillPetti/baseballr\", ref = \"development_branch\")\n```\n\n## **Functionality**\n\nThe package consists of two main sets of functions: data acquisition and metric calculation.\n\nFor example, if you want to see the standings for a specific MLB division on a given date, you can use the `bref_standings_on_date()` function. Just pass the year, month, day, and division you want:\n\n```{r bref_standings_on_date}\nlibrary(baseballr)\nlibrary(dplyr)\nbref_standings_on_date(\"2015-08-01\", \"NL East\", from = FALSE)\n```\n\nRight now the function works as far as back as 1994, which is when both leagues split into three divisions.\n\nYou can also pull data for all hitters over a specific date range. Here are the results for all hitters from August 1st through October 3rd during the 2015 season:\n\n```{r bref_daily_batter}\n\ndata \u003c- bref_daily_batter(\"2015-08-01\", \"2015-10-03\") \ndata %\u003e%\n  dplyr::glimpse()\n```\n\nIn terms of metric calculation, the package allows the user to calculate the consistency of team scoring and run prevention for any year using `team_consistency()`:\n\n```{r team_consistency}\nteam_consistency(2015)\n```\n\nYou can also calculate wOBA per plate appearance and wOBA on contact for any set of data over any date range, provided you have the data available.\n\nSimply pass the proper data frame to `woba_plus`:\n\n```{r woba}\ndata %\u003e%\n  dplyr::filter(PA \u003e 200) %\u003e%\n  woba_plus %\u003e%\n  dplyr::arrange(desc(wOBA)) %\u003e%\n  dplyr::select(Name, Team, season, PA, wOBA, wOBA_CON) %\u003e%\n  dplyr::glimpse()\n```\n\nYou can also generate these wOBA-based stats, as well as FIP, for pitchers using the `fip_plus()` function:\n\n```{r bref_daily_pitcher}\nbref_daily_pitcher(\"2015-04-05\", \"2015-04-30\") %\u003e% \n  fip_plus() %\u003e% \n  dplyr::select(season, Name, IP, ERA, SO, uBB, HBP, HR, FIP, wOBA_against, wOBA_CON_against) %\u003e%\n  dplyr::arrange(dplyr::desc(IP)) %\u003e% \n  head(10)\n```\n\n\n## **Issues**\n\nPlease leave any suggestions or bugs in the [Issues section](https://github.com/billpetti/baseballr/issues).\n\n## **Pull Requests**\n\nPull request are welcome, but I cannot guarantee that they will be accepted or accepted quickly. Please make all pull requests to the [development branch](https://github.com/billpetti/baseballr/tree/development_branch) for review.\n\n## **Breaking Changes**\n\n[**Full News on Releases**](https://billpetti.github.io/baseballr/news/index.html)\n\n## Follow the SportsDataverse (@SportsDataverse) on Twitter and star this repo\n\n\u003c!-- [![Twitter Follow](https://img.shields.io/twitter/follow/SportsDataverse?color=blue\u0026label=%40SportsDataverse\u0026logo=twitter\u0026style=for-the-badge)](https://twitter.com/SportsDataverse)  --\u003e\n\n[![GitHub stars](https://img.shields.io/github/stars/billpetti/baseballr.svg?color=eee\u0026logo=github\u0026style=for-the-badge\u0026label=Star%20baseballr\u0026maxAge=2592000)](https://github.com/billpetti/baseballr/stargazers/)\n\n## **Our Authors**\n\n-   Bill Petti (@BillPetti)       \n\u003c!-- \u003ca href=\"https://twitter.com/BillPetti\" target=\"blank\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/BillPetti?color=blue\u0026label=%40BillPetti\u0026logo=twitter\u0026style=for-the-badge\" alt=\"@BillPetti\" /\u003e\u003c/a\u003e --\u003e\n\u003ca href=\"https://github.com/BillPetti\" target=\"blank\"\u003e\u003cimg src=\"https://img.shields.io/github/followers/BillPetti?color=eee\u0026logo=Github\u0026style=for-the-badge\" alt=\"@BillPetti\" /\u003e\u003c/a\u003e\n\n-   Saiem Gilani (@saiemgilani)       \n\u003c!-- \u003ca href=\"https://twitter.com/saiemgilani\" target=\"blank\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/saiemgilani?color=blue\u0026label=%40saiemgilani\u0026logo=twitter\u0026style=for-the-badge\" alt=\"@saiemgilani\" /\u003e\u003c/a\u003e --\u003e\n\u003ca href=\"https://github.com/saiemgilani\" target=\"blank\"\u003e\u003cimg src=\"https://img.shields.io/github/followers/saiemgilani?color=eee\u0026logo=Github\u0026style=for-the-badge\" alt=\"@saiemgilani\" /\u003e\u003c/a\u003e\n\n\n## **Our Contributors (they're awesome)**\n\n-   Ben Baumer (@BaumerBen)       \n\u003c!-- \u003ca href=\"https://twitter.com/BaumerBen\" target=\"blank\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/BaumerBen?color=blue\u0026label=%40BaumerBen\u0026logo=twitter\u0026style=for-the-badge\" alt=\"@BaumerBen\" /\u003e\u003c/a\u003e --\u003e\n\u003ca href=\"https://github.com/beanumber\" target=\"blank\"\u003e\u003cimg src=\"https://img.shields.io/github/followers/beanumber?color=eee\u0026logo=Github\u0026style=for-the-badge\" alt=\"@beanumber\" /\u003e\u003c/a\u003e\n\n-   Ben Dilday (@BenDilday)      \n\u003c!-- \u003ca href=\"https://twitter.com/BenDilday\" target=\"blank\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/BenDilday?color=blue\u0026label=%40BenDilday\u0026logo=twitter\u0026style=for-the-badge\" alt=\"@BenDilday\" /\u003e\u003c/a\u003e  --\u003e\n\u003ca href=\"https://github.com/bdilday\" target=\"blank\"\u003e\u003cimg src=\"https://img.shields.io/github/followers/bdilday?color=eee\u0026logo=Github\u0026style=for-the-badge\" alt=\"@bdilday\" /\u003e\u003c/a\u003e\n\n-   Robert Frey (@RobertFrey40)      \n\u003c!-- \u003ca href=\"https://twitter.com/RobertFrey40\" target=\"blank\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/RobertFrey40?color=blue\u0026label=%40RobertFrey40\u0026logo=twitter\u0026style=for-the-badge\" alt=\"@RobertFrey40\" /\u003e\u003c/a\u003e  --\u003e\n\u003ca href=\"https://github.com/robert-frey\" target=\"blank\"\u003e\u003cimg src=\"https://img.shields.io/github/followers/robert-frey?color=eee\u0026logo=Github\u0026style=for-the-badge\" alt=\"@robert-frey\" /\u003e\u003c/a\u003e\n\n-   Camden Kay (@k_camden)      \n\u003c!-- \u003ca href=\"https://twitter.com/k_camden\" target=\"blank\"\u003e\u003cimg src=\"https://img.shields.io/twitter/follow/k_camden?color=blue\u0026label=%40k_camden\u0026logo=twitter\u0026style=for-the-badge\" alt=\"@k_camden\" /\u003e\u003c/a\u003e  --\u003e\n\u003ca href=\"https://github.com/camdenk\" target=\"blank\"\u003e\u003cimg src=\"https://img.shields.io/github/followers/camdenk?color=eee\u0026logo=Github\u0026style=for-the-badge\" alt=\"@camdenk\" /\u003e\u003c/a\u003e\n\n## **Citations**\n\nTo cite the [**`baseballr`**](https://billpetti.github.io/baseballr/) R package in publications, use:\n\nBibTex Citation\n```bibtex\n@misc{petti_gilani_2021,\n  author = {Bill Petti and Saiem Gilani},\n  title = {baseballr: The SportsDataverse's R Package for Baseball Data.},\n  url = {https://billpetti.github.io/baseballr/},\n  year = {2021}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbillpetti%2Fbaseballr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbillpetti%2Fbaseballr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbillpetti%2Fbaseballr/lists"}