I'm trying to scrape a table from a player page on Sports Reference's college basketball site using rvest. I'm a total novice at scraping so I haven't had much success. The URL I'm trying to scrape from is https://www.sports-reference.com/cbb/players/anthony-davis-5.html and the tables I'd like to scrape are the "Advanced" and "Per 100 Poss" tables. I saw another answer suggested something like this:
ad <- 'https://www.sports-reference.com/cbb/players/anthony-davis-5.html'
advanced_df <- ad %>%
read_html %>%
html_nodes(xpath = '//comment()') %>%
html_text() %>%
paste(collapse='') %>%
read_html() %>%
html_node("#advanced") %>%
html_table()
when using basketball reference but this hasn't worked for me on college basketball reference. Any help would be much appreciated.