An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20090330/a9f0afa4/attachment.pl>
fImport: yahooKeystats error
2 messages · Andy Zhu, Yohan Chalabi
"AZ" == Andy Zhu <andyzhu35 at yahoo.com> on Mon, 30 Mar 2009 20:47:29 -0700 (PDT)
AZ> How to catch error in this function? My following code seems
AZ> not working with this fImport:
AZ> library(fImport);
AZ> ticker = 'ABI';
AZ> if (inherits(try({ks=yahooKeystats(ticker)}, silent = F),
AZ> try-error)) {
AZ> print('no data');
AZ> }
Hi Andy,
I would set the argument 'try' to FALSE in 'yahooKeystats'.
This gives with your code :
library(fImport);
ticker = 'ABI';
if (inherits(try({ks=yahooKeystats(ticker, try=FALSE)}, silent = F), "try-error")) {
print('no data');
}
But it would be better to cast the error you mentioned inside
'yahooKeystats'. I will have a look at it when I have some spare time.
regards,
Yohan
PhD student Swiss Federal Institute of Technology Zurich www.ethz.ch