r - r edgar 错误:输入年份不是数字
问题描述
我有一个包含 3 家公司(ciknum 变量)和每家公司提交年度报告的年份(fyearq)的“测试”数据框:
ciknum fyearq
1 1408356 2012
2 1557255 2012
3 1557255 2013
4 1557255 2014
5 1557255 2015
6 1557255 2016
7 1555538 2013
8 1555538 2014
9 1555538 2015
10 1555538 2016
获得 MasterIndex 文件夹并运行此代码(请参阅建议的解决方案)后,我使用 R edgar 包获得 10-K 文件。我运行以下代码:
for (i in 1:nrow(test)){
firm<-test[i,"ciknum"] #edit: seems like mistake can be here since new firm data only contains 1 obs of 1 variable
year<-test[i,"fyearq"] #edit: seems like mistake can be here since new year data only contains 1 obs of 1 variable
my_getFilings(firm,'10-K',year,downl.permit="y")
}
它不断吐出以下错误:Error: Input year(s) is not numeric
. 我检查了变量类型,似乎我的 fyearq 变量是数字的。
sapply(test,class)
ciknum fyearq
"numeric" "numeric"
不太明白为什么 my_getFilings 函数不读取“数字” fyearq 变量。任何帮助将非常感激。
先感谢您。
解决方案
Martins 这里的排序似乎很重要。我通过使用函数中的描述符解决了这个问题,所以
my_getFilings(firm,'10-K',year,downl.permit="y")
正如你所写的那样
my_getFilings(cik.no = firm, form.def = '10-K', filing.year = 2016, downl.permit = "y")
推荐阅读
- c# - 为 Android 构建后无法编辑 JSON 文件
- debugging - Kubernetes:如何在使用 PreStop hook 终止之前保存 pod 的日志?
- flutter - 在 Flutter 中将一排圆圈连接到一条链
- intellij-idea - 将 lombok @Value、@NoArgsConstructor、@AllArgsConstructor 放在一起
- python - 如何使用列表推导在满足条件时增加分数
- c++ - 从 C++ 派生类的析构函数调用虚函数
- oracle - SSRS 报表生成器无法在 Win 10 上使用 Oracle 驱动程序
- javascript - 如何在 Angular 项目中为 Android App Links 添加assetlinks.json?
- html - 视频未在 EJS 中加载,(node.js 服务器)
- c# - 如何根据审核日期格式化 dataGrid 行颜色?