Scraping tables from sports reference with RVEST

I’ve sorted it out. The data is all stored as a comment, which I think was my issue. Here is how I’ve extracted the tables, for anyone interested or having similar issues:

url_off %>%
  html_nodes('#all_team_stats') %>%   
  html_nodes(xpath = 'comment()') %>%
  html_text() %>%
  read_html() %>%
  html_node('table') %>%
  html_table()


url_off %>%
  html_nodes('#all_passing') %>%   
  html_nodes(xpath = 'comment()') %>%
  html_text() %>%
  read_html() %>%
  html_node('table') %>%
  html_table()

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top