Obtain "batting" stats going into a game played on May 6th, 2008:
data(urls)
dir <- gsub("players.xml", "batters/",
urls$url_player[1000])
doc <- htmlParse(dir)
nodes <- getNodeSet(doc, "//a")
values <- gsub(" ", "",
sapply(nodes, xmlValue))
ids <- values[grep("[0-9]+", values)]
filenames <- paste(dir, ids, sep="")
stats <- urlsToDataFrame(filenames,
tables=list(Player=NULL),
add.children=TRUE)Run the code above in your browser using DataLab