Skip to content

Instantly share code, notes, and snippets.

@jeffgswanson
Created December 27, 2017 06:30
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 jeffgswanson/b9a8bf21f921b3bd01e306d94beee11b to your computer and use it in GitHub Desktop.
Save jeffgswanson/b9a8bf21f921b3bd01e306d94beee11b to your computer and use it in GitHub Desktop.
Scrape table from www.sports-reference.com and place data into a data frame in R
# SCRAPE STATS
library(RCurl)
library(XML)
# Set URL (make sure to use 'getURL' for https/secure sites)
nebrasketball2017_url <- getURL("https://www.sports-reference.com/cbb/schools/nebraska/2018-schedule.html")
# Pull data from second table on the page into a data frame for analysis
nebrasketball2017 <- readHTMLTable(nebrasketball2017_url, header = T, as.data.frame = T)[[2]]
# Gut check data
View(nebrasketball2017)
@abbottron1990
Copy link

Do you have a recommendation for if I want to pull every college basketball team into one dataset?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment