1

I'm pretty new to R. I'm trying to run the script from this site. http://www.thertrader.com/category/trading-strategies/

I've gotten this far (not too far at all).

library(tseries)
library(quantmod)
library(XML)

startDate <- "2005-01-01"
tables <- readHTMLTable("http://en.wikipedia.org/wiki/List_of_S%26P_500_companies")

Error: failed to load external entity

Can someone help me get this working?

Jota
  • 17,281
  • 7
  • 63
  • 93

1 Answers1

3

There seems to be a weird error in the way readHTMLTable is trying to access the internet (I'm getting the same error). As a workaround, try using httr to download and then parse using readHTMLTable:

library(httr)
tables <- GET("http://en.wikipedia.org/wiki/List_of_S%26P_500_companies")
tables <- readHTMLTable(rawToChar(tables$content))
jeremycg
  • 24,657
  • 5
  • 63
  • 74