我正在尝试使用 postForm 从网上下载 csv 数据,但是,下载的文件似乎是 html 文档而不是 csv 文件。这些是我的代码:
############################
library(RCurl)
url <- "https://research.stlouisfed.org/fred2/series/MKTGDPSAA646NWDB/downloaddata"
params <- list(
"native_frequency" = "Annual", units = "lin",
"frquency" = "Annual", "aggregation" = "Average", "obs_start_date" = "1968-01-01",
"obs_end_date" = "2014-01-01", "file_format" = "csv", "download_data_2" = "", format="csv")
result <- postForm( url, .params = params)
writeBin(as.vector(result),"doc2.txt")