[R-SIG-Finance] fImport: yahooKeystats error

Yohan Chalabi chalabi at phys.ethz.ch
Tue Mar 31 09:43:47 CEST 2009


>>>> "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



More information about the R-SIG-Finance mailing list