1

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.

Taher A. Ghaleb
  • 5,120
  • 5
  • 31
  • 44
adam.888
  • 7,686
  • 17
  • 70
  • 105

1 Answers1

1

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.

Taher A. Ghaleb
  • 5,120
  • 5
  • 31
  • 44