Last active
August 4, 2017 14:32
-
-
Save benjaminrobinson/86b56afd0bdc599a6670d67ba671a7ee to your computer and use it in GitHub Desktop.
This file contains hidden or 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
library(rvest) | |
library(dplyr) | |
library(tidyr) | |
nfl <- data.frame() | |
for(a in letters[!(letters %in% c('q','x','z'))]){ | |
tmp <- read_html( | |
paste0("http://www.espn.com/nfl/college/_/letter/",a) | |
) %>% | |
html_node("table") %>% | |
html_table %>% | |
rename(player=X1,team=X2,position=X3) %>% | |
filter(player!='PLAYER') %>% | |
mutate(college=ifelse(player %in% intersect(.$player,.$team),player,NA)) %>% | |
fill(college) %>% | |
filter(player!=college) | |
nfl <- rbind(nfl,tmp) | |
print(a) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment