Skip to content

Instantly share code, notes, and snippets.

@mhkeller
Forked from drewconway/get_scores.R
Created August 7, 2012 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mhkeller/3287942 to your computer and use it in GitHub Desktop.
Save mhkeller/3287942 to your computer and use it in GitHub Desktop.
Function returns quater scores from Wikipedia Super Bown pages
# Function returns quater scores from Wikipedia Super Bown pages
get.scores<-function(numeral) {
# Base URL for Wikipedia
wp.url<-getURL(paste("http://en.wikipedia.org/wiki/Super_Bowl_",numeral,sep=""))
wp.data<-htmlTreeParse(wp.url, useInternalNodes=TRUE)
score.html<-getNodeSet(wp.data,"//table[@style='background-color:transparent;']")
score.table<-readHTMLTable(score.html[[1]])
score.table<-transform(score.table, SB=numeral)
return(score.table)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment