R的quantmod包中的library(quantmod)
getSymbols('CPIAUCNS',src='FRED')
命令不再适用于FRED数据(即,对于圣路易斯联邦储备银行数据库,请通过:fred.stlouisfed.org)。例如,使用R中的quantmod帮助菜单提供了此示例,该示例不再有效:
Error: Failed to download file. Error message:
cannot open URL
'https://fred.stlouisfed.org/series/CPIAUCNS/downloaddata/CPIAUCNS.csv'
If this is related to https, possible solutions are:
1. Explicitly pass method= via the getSymbols call (or via setDefaults)
2. Install downloader, which may be able to automagically determine a method
3. Set the download.file.method global option
In addition: Warning message:
In download.file(url, destfile, method, quiet, mode, cacheOK, extra) :
cannot open URL
'https://fred.stlouisfed.org/series/CPIAUCNS/downloaddata/CPIAUCNS.csv':
HTTP status was '404 Not Found'
运行此命令会产生此错误:
getSymbols
显然,圣路易斯联邦储备银行改变了FRED代码的网页地址,并且对于新地址来说并不明显(至少对我而言)。您仍然可以手动将数据下载到Excel文件中。但是FRED的ref = db.getReference("/foo/{var}/bar");
被打破了。有想法该怎么解决这个吗?谢谢!