Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.