2

I am using the EDGAR library in R to download all 2005 10-Ks. The below code will prompt "yes" download the 10-K for each CIK in my loop. (h/t to Weihuang Wong to assisting me with this.)

install.packages("edgar")

library(edgar) 

report <- getMasterIndex(2005)

x <- capture.output(dput(edgar::getFilings))
x <- gsub("choice <- .*", "cat(paste(msg3, '\n')); choice <- 'yes'", x)
x <- gsub("^function", "my_getFilings <- function", x)
writeLines(x, con = tmp <- tempfile())
source(tmp)

for(CIK in c(789019, 777676, 849399)){
 my_getFilings(2005, CIK, '10-K')
}

list.files(file.path(getwd(), "Edgar filings"))

I have downloaded this mapper and loaded it into R. It gives me the SIC industry # for each CIK code.

CIK <- read.csv("cik-ticker.csv")

How could I expand my code to look for a 10-K for every CIK on this list while grouping them by SIC code? I tried at defining CIK and SIC and creating a matrix but wasn't sure how to make my dimensions dynamic for the # of SIC codes I would get.

1
  • This would be much easier to answer if you provided a short example of what you expect to be looked up and what the resulting output should look like.
    – Juergen
    Commented Feb 6, 2017 at 3:13

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.