Giter Club home page Giter Club logo

retrosheet's Introduction

retrosheet

R-CMD-check CRAN_Status_Badge License: GPL 2.0 GitHub commit Downloads

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 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.

Installation

retrosheet can be installed from CRAN, or development versions installed from Github.

# 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

retrosheet's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

markromanmiller

retrosheet's Issues

closeAllConnections in getRetrosheet breaks knitr

Similar to this issue: https://stackoverflow.com/questions/41372927/isincompletecon-error-when-knitting-pdf, the closeAllConnections calls in getRetrosheet currently break knitr with the error:

Quitting from lines 105-106 (Chapter04.Rmd) 
Error in isIncomplete(con) : invalid connection
Calls: <Anonymous> ... evaluate_call -> handle_output -> <Anonymous> -> isIncomplete
Quitting from lines 105-106 (Chapter04.Rmd) 
Error in isOpen(con) : invalid connection
Calls: <Anonymous> ... <Anonymous> -> evaluate_call -> <Anonymous> -> isOpen
Execution halted

trying to create tibble from your package

Hi Mr. Douglas, I am trying to create from your retrosheet package a tibble with column names as in retrosheet.org. But, if I do get_Retrosheet("play", 2020, "SFN"), I will get a list with the 30 home games of SFN, which is also subdivided in other lists and other lists... with different number of rows. Any suggestion?

Capture

Tidying the play codes

Hi team,

I'm in the middle of writing out some regex to parse the play codes (e.g, K, SB2, W, HR/89/F.2-H;1-H) into a tidier format, and I was wondering if that would be useful for this package. If so, I can make a pull request when I've fleshed out the code.

Mark

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.