{"id":17044322,"url":"https://github.com/pdwaggoner/mlbstats","last_synced_at":"2025-03-23T02:27:22.391Z","repository":{"id":194114332,"uuid":"125541513","full_name":"pdwaggoner/mlbstats","owner":"pdwaggoner","description":"Vector-based MLB Player Statistics Calculator","archived":false,"fork":false,"pushed_at":"2024-09-19T15:05:42.000Z","size":159,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-28T05:28:31.360Z","etag":null,"topics":["mlb","player-level-metrics","sabermetrics","statistics"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pdwaggoner.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2018-03-16T16:22:07.000Z","updated_at":"2024-09-19T15:05:46.000Z","dependencies_parsed_at":"2024-11-29T18:41:24.169Z","dependency_job_id":"a2b86aad-421e-4381-a9fb-cac088ad402a","html_url":"https://github.com/pdwaggoner/mlbstats","commit_stats":null,"previous_names":["pdwaggoner/mlbstats"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdwaggoner%2Fmlbstats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdwaggoner%2Fmlbstats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdwaggoner%2Fmlbstats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdwaggoner%2Fmlbstats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pdwaggoner","download_url":"https://codeload.github.com/pdwaggoner/mlbstats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245046842,"owners_count":20552286,"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","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":["mlb","player-level-metrics","sabermetrics","statistics"],"created_at":"2024-10-14T09:33:59.685Z","updated_at":"2025-03-23T02:27:22.360Z","avatar_url":"https://github.com/pdwaggoner.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `mlbstats`: Major League Baseball Player Statistics Calculator\n\n[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/mlbstats)](http://cran.r-project.org/package=mlbstats) \n[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/mlbstats)](https://cran.r-project.org/package=mlbstats)\n[![Documentation](https://img.shields.io/badge/documentation-mlbstats-orange.svg?colorB=E91E63)](https://www.r-pkg.org/pkg/mlbstats)\n[![](https://img.shields.io/badge/CTV-SportsAnalytics-red)](https://cran.r-project.org/web/views/SportsAnalytics.html)\n\n\n## Why should I use `mlbstats`?\n\nThis package is a player-level baseball statistics calculator. Similar to using `sum(2,2)` to perform the operation `2 + 2`, `mlbstats` allows for simple computation of a host of player-level metrics based on raw inputs. Common metrics from major league baseball (MLB) include batting, pitching, fielding, baserunning, and player-summary statistics. The goal of this package, then, is to provide an easy-to-use calculator to efficiently calculate player metrics based on raw, easily obtainable data. For some other metrics such as WAR, UZR, PWA, etc., see \u003chttps://www.baseball-reference.com/\u003e or Bill James' sabermetrics guides.\n\nTake a look at the package, along with many other excellent related packages, in the [Sports Analytics CRAN Task View](https://cran.r-project.org/web/views/SportsAnalytics.html). \n\n## How do I use `mlbstats`?\n\nFrom the simplest calculations (e.g., batting average = number of hits / at bats) to complicated ones (e.g., a pitcher's component earned run average, calculated as, `9 * ((h + bb + hbp) * (0.89 * (1.255 * (h - hr) + 4 * hr) + 0.56 * (bb + hbp - ibb)) / (bfp * ip)) - 0.56)`), unique functions in `mlbstats` take unique values from player-level data, and return the desired metric.\n\n## Installation\n\n```{r }\ninstall.packages(\"mlbstats\")\nlibrary(mlbstats)\n```\n\n## Implementation\n\n###### Jose Altuve's (Houston Astros Silver Slugger) 2017 Regular Season OBP (on-base percentage)\n\n```{r }\nobp(\n  h = 204, # hits\n  bb = 58, # walks\n  hbp = 9, # hits by pitch\n  ab = 590, # at bats\n  sf = 4 # sacrifice flys\n) \n```\n\n[1] 0.4099849\n\nCorroborate with the official MLB statistics, recording Altuve's 2017 regular season OBP as `0.410`. \n\n###### Chris Sale (Boston Red Sox Pitcher) 2017 Regular Season PFR (power finesse ratio)\n\n```{r mlbstats}\npfr(\n  k = 308, # strikeouts\n  bb = 43, # walks\n  ip = 214.1 # innings pitched\n)\n```\n\n[1] 1.639421\n\n## How do I get `mlbstats`?\n\nLoad the package (0.1.0) from [CRAN](https://CRAN.R-project.org/package=mlbstats). If you have any questions, find any bugs requiring fixing, or find metrics I left out, either open an [issue ticket](https://github.com/pdwaggoner/mlbstats/issues) or feel free to [reach out directly](https://pdwaggoner.github.io/). If you use the package for any published work, I would love to know!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdwaggoner%2Fmlbstats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdwaggoner%2Fmlbstats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdwaggoner%2Fmlbstats/lists"}