Reputation: 7846
I am trying to webscrape a table. I tried the code below but it does not work giving an error message:
XML content does not seem to be XML
library(XML)
link1 <- "https://www.westmetall.com/en/markdaten.php?action=show_table&field=LME_Cu_cash"
table1 <-readHTMLTable(link1,stringsAsFactors = FALSE)
table1
dd = do.call(rbind,table1)
dd
Thank you for your help.
Upvotes: 1
Views: 517
Reputation: 5240
You may use getURL()
to obtain the html content, and then use readHTMLTable
, like this:
library(XML)
library(RCurl) # for getURL()
link1 <- "https://www.westmetall.com/en/markdaten.php?action=show_table&field=LME_Cu_cash"
html <- getURL(link1)
table1 <-readHTMLTable(html,stringsAsFactors = FALSE)
Hope it helps.
Upvotes: 1