Package retrosheet. April 13, 2015



Similar documents
Package uptimerobot. October 22, 2015

Package OECD. R topics documented: January 17, Type Package Title Search and Extract Data from the OECD Version 0.2.

Package sjdbc. R topics documented: February 20, 2015

Package pdfetch. R topics documented: July 19, 2015

Package sendmailr. February 20, 2015

Package TSfame. February 15, 2013

Package translater. R topics documented: February 20, Type Package

Package LexisPlotR. R topics documented: April 4, Type Package

Package searchconsoler

Package RCassandra. R topics documented: February 19, Version Title R/Cassandra interface

Package pinnacle.api

Package GEOquery. August 18, 2015

Package hoarder. June 30, 2015

Package urltools. October 11, 2015

Package R4CDISC. September 5, 2015

Package brewdata. R topics documented: February 19, Type Package

Package erp.easy. September 26, 2015

Package syuzhet. February 22, 2015

Package dsstatsclient

Package fimport. February 19, 2015

Package MBA. February 19, Index 7. Canopy LIDAR data

Package HadoopStreaming

Package decompr. August 17, 2016

Package empiricalfdr.deseq2

Data Storage STAT 133. Gaston Sanchez. Department of Statistics, UC Berkeley

Package cgdsr. August 27, 2015

Package neuralnet. February 20, 2015

Package bigrf. February 19, 2015

Package benford.analysis

Package optirum. December 31, 2015

Package hive. July 3, 2015

Package plan. R topics documented: February 20, 2015

Package tagcloud. R topics documented: July 3, 2015

Package dsmodellingclient

Package missforest. February 20, 2015

Package DCG. R topics documented: June 8, Type Package

Package httprequest. R topics documented: February 20, 2015

Package hive. January 10, 2011

Package ggrepel. February 8, 2016

Package globe. August 29, 2016

Package date. R topics documented: February 19, Version Title Functions for handling dates. Description Functions for handling dates.

Package pxr. February 20, 2015

Package TRADER. February 10, 2016

Package ChannelAttribution

Package packrat. R topics documented: March 28, Type Package

Package treemap. February 15, 2013

Package dunn.test. January 6, 2016

Package GSA. R topics documented: February 19, 2015

org.rn.eg.db December 16, 2015 org.rn.egaccnum is an R object that contains mappings between Entrez Gene identifiers and GenBank accession numbers.

Package wordnet. January 6, 2016

Package jrvfinance. R topics documented: October 6, 2015

Package EasyHTMLReport

Package sudoku. February 20, 2015

Package klausur. February 20, 2015

Package AzureML. August 15, 2015

Package TimeWarp. R topics documented: April 1, 2015

Package bizdays. March 13, 2015

Package DDIwR. R topics documented: February 19, Version Date Title DDI with R Depends R (>= 3.1.0) Imports XML, foreign

Package png. February 20, 2015

Cabot Consulting Oracle Solutions. The Benefits of this Approach. Infrastructure Requirements

Configuring Data Masking

Package survpresmooth

Package changepoint. R topics documented: November 9, Type Package Title Methods for Changepoint Detection Version 2.

Package acrm. R topics documented: February 19, 2015

Package HHG. July 14, 2015

Package EstCRM. July 13, 2015

Package xtal. December 29, 2015

Package RDAVIDWebService

Package PRISMA. February 15, 2013

Package RedditExtractoR

Package PKI. February 20, 2013

Package PKI. July 28, 2015

Dataframes. Lecture 8. Nicholas Christian BIOST 2094 Spring 2011

Hands-On Data Science with R Dealing with Big Data. Graham.Williams@togaware.com. 27th November 2014 DRAFT

Package RSQLite. February 19, 2015

Package lmertest. July 16, 2015

Package MDM. February 19, 2015

Package Rdsm. February 19, 2015

Package DSsim. September 25, 2015

Reading and writing files

My IC Customizer: Descriptors of Skins and Webapps for third party User Guide

Package colortools. R topics documented: February 19, Type Package

Protection, Usability and Improvements in Reflected XSS Filters

Introduction to the data.table package in R

Package cpm. July 28, 2015

Package hazus. February 20, 2015

Package ATE. R topics documented: February 19, Type Package Title Inference for Average Treatment Effects using Covariate. balancing.

Package instar. November 10, 2015

Transcription:

Type Package Package retrosheet April 13, 2015 Title Import Professional Baseball Data from 'Retrosheet' Version 1.0.2 Date 2015-03-17 Maintainer Richard Scriven <rmscriven@gmail.com> A collection of tools to import and structure the (currently) single-season event, game-log, roster, and schedule data available from http://www.retrosheet.org. In particular, the event (a.k.a. play-by-play) files can be especially difficult to parse. This package does the parsing on those files, returning the requested data in the most practical R structure to use for sabermetric or other analyses. URL http://github.com/rmscriven/retrosheet Depends R (>= 2.10) License GPL (>= 2) Imports RCurl (>= 1.95-4.5), XML (>= 3.98-1.1), data.table (>= 1.9.4), stringi (>= 0.4-1) Note NOTICE regarding the transfer of data from Retrosheet: The information used here was obtained free of charge from and is copyrighted by Retrosheet. Interested parties may contact Retrosheet at ``www.retrosheet.org''. Author Richard Scriven [aut, cre] NeedsCompilation no Repository CRAN Date/Publication 2015-04-13 22:37:39 R topics documented: getfilenames........................................ 2 getparkids......................................... 2 getpartialgamelog..................................... 3 getretrosheet........................................ 4 getteamids......................................... 5 1

2 getparkids Index 6 getfilenames Files currently available for download A convenience function, returning the base file names of the available downloads for the year and type arguments in getretrosheet. getfilenames() A named list of available single-season Retrosheet event and game-log zip files, and schedule text files. These file names are not intended to be passed to getretrosheet, but is simply a fast way to determine if the desired data is available. getfilenames() getparkids A data frame of ballpark IDs This function returns a two-column data frame of ballpark IDs along with current stadium name getparkids() getparkids()

getpartialgamelog 3 getpartialgamelog Partial parser for game-log files Instead of returning the entire file, this function allows the user to choose the columns and date for game-log data. getpartialgamelog(year, glfields, date = NULL,...) gamelogfields Arguments year glfields date A single four-digit year. character. The desired game-log columns. This should be a subset of gamelogfields, and not the entire vector. One of either NULL (the default), or a single four-digit character string identifying the date mmdd... further arguments passed to download.file Format chr [1:161] "Date" "DblHdr" "Day" "VisTm" "VisTmLg"... getpartialgamelog - A data table with dimensions length(date) x length(glfields) if date is not NULL, otherwise the row dimension is the nuber of games for the given year. gamelogfields - A character vector of possible values to choose from for the glflields argument in getpartialgamelog. ## Get Homerun and RBI info for the 2012 season, with park ID f <- grep("hr RBI Park", gamelogfields, value = TRUE) getpartialgamelog(2012, glfields = f) ## Get Homerun and RBI info for August 25, 2012 - with park ID getpartialgamelog(glfields=f, date = "20120825")

4 getretrosheet getretrosheet Import single-season retrosheet data as a structured R object This function downloads and parses data from http://www.retrosheet.org for the game-log, event, (play-by-play), roster, and schedule files. getretrosheet(type, year, team, schedsplit = NULL, stringsasfactors = FALSE,...) Arguments type year team schedsplit character. This argument can take on either of "game" for game-logs, "play" for play-by-play (a.k.a. event) data, "roster" for team rosters, or "schedule" for the game schedule for the given year. integer. A valid four-digit year. character. Only to be used if type = "play". A single valid team ID for the given year. For available team IDs for the given year call getteamids(year). The available teams are in the "TeamID" column. One of "Date", "HmTeam", or "TimeOfDay" to return a list split by the given value, or NULL (the default) for no splitting. stringsasfactors logical. The stringsasfactors argument as used in data.frame. Currently applicable to types "game" and "schedule".... further arguments passed to download.file. The following return values are possible for the given type game - a data frame of gamelog data for the given year play - a list, each element of which is a single game s play-by-play data for the given team and year. Each list element is also a list, containing the play-by-play data split into individual matrices. roster - a named list, each element containing the roster for the named team for the given year, as a data frame. schedule - a data frame containing the game schedule for the given year

getteamids 5 ## get the full 1995 season schedule getretrosheet("schedule", 1995) ## Not run: ## get the same schedule, split by time of day getretrosheet("schedule", 1995, schedsplit = "TimeOfDay") ## get the roster data for the 1995 season, listed by team getretrosheet("roster", 1995) ## get the full gamelog data for the 2012 season getretrosheet("game", 2012) ## get the play-by-play data for the San Francisco Giants 2012 season getretrosheet("play", 2012, "SFN") ## End(Not run) getteamids Retrieve team IDs for event files This function retrieves the team ID needed for the team argument of getretrosheet("play", year, team). getteamids(year, quiet = TRUE,...) Arguments year A single valid four-digit numeric year. quiet logical. Passed to download.file... further arguments passed to download.file. Details All currently available years can be retrieved with type.convert(substr(getfilenames()$event, 1L, 4L)) If the file exists, a named vector of IDs for the given year. Otherwise NA. getteamids(2010)

Index Topic datasets getpartialgamelog, 3 data.frame, 4 download.file, 3 5 gamelogfields (getpartialgamelog), 3 getfilenames, 2 getparkids, 2 getpartialgamelog, 3 getretrosheet, 4 getteamids, 5 6