R:在功能循环中自动提示答案

时间:2018-11-14 01:54:34

标签: r function loops edgar

我试图循环使用edgar::getFilings函数来下载不同年份的不同公司的10Q和10K。

对于每次运行,功能提示:

Total number of filings to be downloaded=1. Do you want to download (yes/no)?

对于循环的每次迭代,我都必须在命令提示符下键入yes。有办法避免这种情况吗?

library(edgar)
companies = c(19617,886982,895421,831001,070858)
years = c(2017,2018)
reports = c('10-K','10-Q')
getMasterIndex(years)

mylist = list()

for (i in 1:length(companies)) {
  for (t in 1:length(years)) {
    for (j in 1:length(reports)) {
      mylist[[paste(companies[i],years[t],reports[j],sep = "_")]] = 
        getFilings(years[t], companies[i], reports[j])
    }
  }
}

0 个答案:

没有答案