0

I am trying to harvest the world football elo ratings with rvest but I keep getting an empty list

Using the inspect element in google chrome I get the xpath //*[(@id = "maintable_2014_World_Cup_start")]/div[6]

library(rvest)
library(dplyr)

page<-"http://www.eloratings.net/2014_World_Cup_start"

elo_rating<-read_html(page)%>%
   html_nodes(xpath='//[@id="maintable_World"]/div[6]')%>%
   html_table()

I get an empty list

Searching online and within SE, I came across this and perhaps it has to do something with javascript (which I know nothing about..:). Also, when at the page source (with google chrome) I see a lot of calls to javascript

Lastly, I came across this R publication, with an example of extracting data from the same website, but when I try to replicate the R code, I still get empty lists and empty character objects

I went through many threads here in SE (this, this, this but I can't find a solution

If the obstacle is javascript, is there anything I can do to extract the data?

1 Answers1

1

The obstacle does seem to be javascript as the tables are generated by it. I think you need to use PhantomJS to render the tables and grab them. See this page for help.

Anders Ellern Bilgrau
  • 9,109
  • 1
  • 24
  • 35