getData: Retrieves MLBAM GameDay files

Description Usage Arguments Details Value Examples

Description

Retrieves MLBAM GameDay files for a specified time interval using multiple calls of the gameday function.

Usage

1
2
3
4
5
6
getData(start = Sys.Date() - 1, end = NULL, gameIds = NULL,
  drop.suspended = TRUE)

getDataMonthly(yyyy = 2013, m = 5)

getDataWeekly(start = Sys.Date() - 8)

Arguments

start

A valid date in yyyy-mm-dd format (default is Sys.Date() - 1 (i.e. yesterday))

end

A valid date in yyyy-mm-dd format (default is NULL, which then uses the same value as start (i.e. yesterday))

gameIds

a vector of specific gameIds that you want to retrieve. If NULL (the default), then the dates are used to fetch the relevant gameIds

drop.suspended

Logical indicating whether games with fewer than 5 innings should be excluded. Default is TRUE.

yyyy

A year

m

A numeric value corresponding to a month

Details

Given a beginning and end date, this function will retrieve all data from the MLBAM GameDay server in the specified interval and process them into a single data frame.

Value

A tbl_df of class GameDayPlays consisting of play-by-play data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Get data from one day
ds = getData(start = '2013-03-31')
# Get data from multiple days
## Not run: 
ds = getData(start = '2013-03-31', end = '2013-04-02')

## End(Not run)
# Get data for entire 2013 season
## Not run: 
ds = getData(start = '2013-03-31', end = '2013-09-30')

## End(Not run)

# Retrieve all of the MLBAM data from May 2013
## Not run: 
# ds = getDataMonthly(2013, 5)

## End(Not run)

# Retrieve all the data from the first week of the 2013 season
## Not run: 
ds = getDataWeekly('2013-03-31')

## End(Not run)

beanumber/openWAR documentation built on May 12, 2019, 9:43 a.m.