Learn R Programming

retrosheet (version 1.0.2)

getPartialGamelog: Partial parser for game-log files

Description

Instead of returning the entire file, this function allows the user to choose the columns and date for game-log data.

Usage

getPartialGamelog(year, glFields, date = NULL, ...)
gamelogFields

Arguments

year
A single four-digit year.
glFields
character. The desired game-log columns. This should be a subset of gamelogFields, and not the entire vector.
date
One of either NULL (the default), or a single four-digit character string identifying the date 'mmdd'
...
further arguments passed to download.file

Value

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

Format

 chr [1:161] "Date" "DblHdr" "Day" "VisTm" "VisTmLg" ...

Examples

Run this code
## 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")

Run the code above in your browser using DataLab