Girish
Girish

Reputation: 1

readHTMLTable() returning a List of 0

I am trying to read a table using readHTML() function in R. But getting the result - List of 0 and the error message as below:

"XML content does not seem to be XML: 'https://www.forbes.com/powerful-brands/list/#tab:rank' "

I have already tried using library(XML) and library(RCurl) before readHTMLTable() function.

I tried below options till now

library(XML)

Forbes=readHTMLTable("https://www.forbes.com/powerful-brands/list/#tab:rank",as.data.frame = TRUE)

Another way.

library(XML)
library(RCurl) 

URL<- "https://www.forbes.com/powerful-brands/list/#tab:rank"

Forbeslist <- readHTMLTable(getURL(URL))

getting below error message:

"XML content does not seem to be XML: 'https://www.forbes.com/powerful-brands/list/#tab:rank' "

Upvotes: 0

Views: 104

Answers (1)

aparpara
aparpara

Reputation: 2201

The table on the site is generated by a script. You can see it if you disable scripts in a browser or just download the page using wget https://www.forbes.com/powerful-brands/list/#tab:rank. R doesn't execute scripts, so it doesn't see any table.

Upvotes: 1

Related Questions