https://github.com/colindouglas/retrosheet
R package for importing historical baseball data from Retrosheet
https://github.com/colindouglas/retrosheet
baseball-analytics baseball-data baseball-statistics cran gamelog retrosheet
Last synced: 8 months ago
JSON representation
R package for importing historical baseball data from Retrosheet
- Host: GitHub
- URL: https://github.com/colindouglas/retrosheet
- Owner: colindouglas
- Created: 2020-04-15T19:03:11.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-02-28T14:44:50.000Z (over 2 years ago)
- Last Synced: 2025-10-22T05:51:03.460Z (8 months ago)
- Topics: baseball-analytics, baseball-data, baseball-statistics, cran, gamelog, retrosheet
- Language: R
- Homepage: https://CRAN.R-project.org/package=retrosheet
- Size: 146 KB
- Stars: 5
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
message=FALSE,
warning=FALSE
)
```
# retrosheet
[](https://github.com/colindouglas/retrosheet/actions/workflows/R-CMD-check.yaml)
[](https://cran.r-project.org/package=retrosheet)
[-blue.svg)](https://opensource.org/license/gpl-2-0)
[](https://github.com/colindouglas/retrosheet/commit/main)
[](https://cran.r-project.org/package=retrosheet)
Import Retrosheet data as a structured R object
`retrosheet` is an R package that downloads and parses the single-season event, gamelog, roster, and schedule
files from [retrosheet.org](https://www.retrosheet.org/) into structured R objects for further analysis.
**Note:** As of retrosheet 1.1.0, this repo contains the version available on CRAN. Older versions can be found [here](https://github.com/rmscriven/retrosheet).
## Installation
`retrosheet` can be installed from CRAN, or development versions installed from Github.
```r
# Install from CRAN
install.packages("retrosheet")
# Install development version from Github
# install.packages("devtools")
devtools::install_github("colindouglas/retrosheet")
```
## Usage
* `getRetrosheet()` - This workhorse function returns the full seasonal data associated with the user-entered
arguments
* Use the `cache` argument to save a local cache and avoid stressing retrosheet.org
* Use `get_retrosheet()` as a drop-in replacement to return tibbles instead of matrices
* `getPartialGamelog()` - An alternative to returning the full gamelog files. This function allows the user
to choose the columns and date. Column names are made available by the global object `gamelogFields`
Also included are convenience functions
* `getFileNames()` - for obtaining a list of all zip files currently available for use by this package
* `getTeamIDs()` - for providing the team ID value to be used in the `team` argument of `getRetrosheet()`
* `getParkIDs()` - for ballpark ID and name information