0

I am trying to scrape data from football reference using this code:

season<-2020
team<-"nwe"
html<-paste("https://www.pro-football-reference.com/teams/",team,"/",season,"_roster.htm", sep="")
x<-read_csv(html)
table <- "table#roster"

html %>%
  read_html() %>%
  html_nodes(table) %>%
  html_table()
  

Running this code gives me an empty list. My intention is to scrape the second table on the page. Scraping the first table works regardless of which method I use, but getting the second one is impossible. I am getting really annoyed because there is no logical reason for this to be happening.

IF I replaced table <- "table#roster" with table <-"table#starters" then the code effectively reads in the first table from the website.

0 Answers0