【发布时间】:2021-02-25 17:12:48
【问题描述】:
我正在尝试使用edgarWebR 包从 EDGAR 获取公司及其备案信息。特别是,我想使用包中的两个函数 - filing_information 和 company_filings。
我实际上在不同的数据集中有数千个cik,但上面的两个函数都无法处理cik 的向量。这是一个例子-
library(edagrWebR)
comp_file <- company_filings(c("1000045"), before = "20201231",
type = "10-K", count = 100,
page = 1)
head(comp_file)
accession_number act file_number filing_date accepted_date
1 <NA> 34 000-26680 2020-06-22 2020-06-22
2 <NA> 34 000-26680 2019-06-28 2019-06-28
3 <NA> 34 000-26680 2018-06-27 2018-06-27
4 <NA> 34 000-26680 2017-06-14 2017-06-14
5 <NA> 34 000-26680 2016-06-14 2016-06-14
6 <NA> 34 000-26680 2015-06-15 2015-06-15
href
1 https://www.sec.gov/Archives/edgar/data/1000045/000156459020030033/0001564590-20-030033-index.htm
2 https://www.sec.gov/Archives/edgar/data/1000045/000156459019023956/0001564590-19-023956-index.htm
3 https://www.sec.gov/Archives/edgar/data/1000045/000119312518205637/0001193125-18-205637-index.htm
4 https://www.sec.gov/Archives/edgar/data/1000045/000119312517203193/0001193125-17-203193-index.htm
5 https://www.sec.gov/Archives/edgar/data/1000045/000119312516620952/0001193125-16-620952-index.htm
6 https://www.sec.gov/Archives/edgar/data/1000045/000119312515223218/0001193125-15-223218-index.htm
type film_number
1 10-K 20977409
2 10-K 19927449
3 10-K 18921743
4 10-K 17910577
5 10-K 161712394
6 10-K 15931101
form_name
1 Annual report [Section 13 and 15(d), not S-K Item 405]
2 Annual report [Section 13 and 15(d), not S-K Item 405]
3 Annual report [Section 13 and 15(d), not S-K Item 405]
4 Annual report [Section 13 and 15(d), not S-K Item 405]
5 Annual report [Section 13 and 15(d), not S-K Item 405]
6 Annual report [Section 13 and 15(d), not S-K Item 405]
description size
1 <NA> 14 MB
2 <NA> 10 MB
3 <NA> 5 MB
4 <NA> 5 MB
5 <NA> 5 MB
6 <NA> 7 MB
我需要在filing_information函数中使用href变量。
其实我也试过这样用-
file_info <- filing_information(comp_file$href)
但它不起作用。我收到了这条消息 -
Error in parse_url(url) : length(url) == 1 is not TRUE
我实际上可以通过如下方式放置每个 href 变量值来做到这一点
x <- "https://www.sec.gov/Archives/edgar/data/1000045/000156459020030033/0001564590-20-030033-index.htm"
file_info <- filing_information(x)
company_filings 函数也是如此,我只使用一个 cik - “1000045”,但在另一个文件中,我有数千个 cik,所有这些我都想运行 company_filings 函数.手动是不可能的,因为我有成千上万的cik。
任何人都知道如何在 LARGE 向量上自动执行这两个函数。
谢谢
【问题讨论】:
-
res <- lapply(setNames(nm=comp_file$href), filing_information)将为您提供list的返回值。如果它的返回是data.frame,那么您可以考虑将结果与以下之一组合:do.call(rbind.data.frame, res)、dplyr::bind_rows(res, .id="href")或data.table::rbindlist(res, idcol="href")。 -
@r2evans 效果很好。我该怎么做
company_filing。我为company_filing-res2 <- lapply(setNames(nm=df2$cik), company_filings)尝试了这个,它可以工作,但是如何添加company_filing函数的其他参数,如before = "20201231",type = "10-K", count = 100, page = 1