Gunratan / edgar

Tool for the U.S. SEC EDGAR Retrieval and Parsing of Corporate Filings
29 stars 14 forks source link

getBusinDescr() issue with tie in maximum word count #9

Open matthewgson opened 6 months ago

matthewgson commented 6 months ago
getBusinDescr(cik.no = 'ALL', filing.year = 1996)
Error in if ((!is.na(product.descr)) & (max(words.count) > 100)) { : 
  the condition has length > 1

Intended is scalar output by choosing word count being maximum: https://github.com/Gunratan/edgar/blob/b2f9b47fa3722f03b81e7adb9c8ec94b576bc823/R/getBusinessDescr.R#L219

However above results in a vector output if there's a tie in maximum word count. Perhaps using the below would solve the issue? I can PR if it seems fine. Thank you.

if (length(product.descr) > 1) { product.descr <- product.descr[which.max(words.count)] }