makeUrls: Construct Gameday urls based on some parameters.

Description Usage Arguments Value Examples

Description

This is a convenience function (used by scrape) which constructs urls with the common Gameday root http://gd2.mlb.com/components/game/mlb/.

Usage

1
makeUrls(start, end, gids = "infer")

Arguments

start

date "yyyy-mm-dd" to commence scraping.

end

date "yyyy-mm-dd" to terminate scraping.

gids

The default value "infer" suggests gameday_links should be derived and appended appropriately (based on values of start and end). Otherwise, a character vector with gameday_links can be supplied.

Value

Returns a character vector.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# XML file names with pitch-by-pitch level data
prefix <- makeUrls(start="2011-04-04", end="2011-04-04")
paste0(prefix, "/inning/inning_all.xml")
# XML file names with hit location data
paste0(prefix, "/inning/inning_hit.xml")
# XML file names with game-by-game level data
paste0(makeUrls(start="2011-04-04", end="2011-04-04", gids=""), "/miniscoreboard.xml")
# Use gids option instead
data(gids)
identical(prefix, makeUrls(gids=gids[grep("2011_04_04", gids)]))


Search within the pitchRx package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.