R quantmod:getFinancials

依然范特西╮ 提交于 2019-12-06 03:37:52

You can put the call to getFinancials between tryCatch. Here an example:

options(warn=-1)  ## optional to not get horrible quantlib messages!
 ## here I choose 2 goods symbols and 2 bad symbols    
 ll <- lapply(c("AF","IHG","BAP",ny.se[1,1]), function(x)
   tryCatch(getFinancials(x,env=nyse.fs),
                     error=function(e){print(paste(x,'not found'));NA}))
### "AF not found"
### "BAP not found"
options(warn=0)
## I apply to remove NA 
rapply(ll,na.omit)
"IHG.f" "A.f"  
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!