Search code examples
rquantmod

Quantmod Error 'cannot open URL'


I started to experience an error today with the quantmod package. Anybody else have the same error when running this code (or requesting symbols in general)?

library(quantmod) getSymbols("CPIAUCNS",src="FRED")

Error:
Error in download.file(paste(FRED.URL, "/", Symbols[[i]], "/", "downloaddata/", : cannot open URL 'http://research.stlouisfed.org/fred2/series/CPIAUCNS/downloaddata/CPIAUCNS.csv'

The URL itself works fine.


Solution

  • Another (temporary) solution is to call one of the following before the actual getSymbols script:

    options(download.file.method="libcurl")
    or
    options(download.file.method="wget")
    or
    options(download.file.method="wininet")

    The first option works for me (on Mac).
    Thanks Paul Gilbert from Rmetrics (bottom post)