Created
December 27, 2017 06:30
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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
Do you have a recommendation for if I want to pull every college basketball team into one dataset?