[R-sig-finance] Behaviour of get.hist.quote when presented with bad inputs

Ajay Narottam Shah ajayshah at mayin.org
Tue May 9 11:11:31 CEST 2006


With R 2.3, when I say get.hist.quote("rubbish") he gets extremely unhappy:

> library(tseries)
Loading required package: quadprog
Loading required package: zoo
> x <- get.hist.quote("rubbish")
trying URL
'http://chart.yahoo.com/table.csv?s=rubbish&a=0&b=02&c=1991&d=4&e=08&f=2006&g=d&q=q&y=0&z=rubbish&x=.csv'

 *** caught segfault ***
address 0x5f4d4550, cause 'memory not mapped'

Traceback:
 1: download.file(url, destfile, method = method)
 2: get.hist.quote("rubbish")

Possible actions:
1: abort (with core dump)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Selection: c

I believe that before R 2.3, it was not so bad - there was no segfault
when a bad input was presented. I feel that it's enough to return NULL
when presented with "rubbish", but segfaulting is kinda extreme.

I tried to say
  > try(x <- get.hist.quote("rubbish"))
but that also segfaults.

How can I do better?

My machine is an ibook running an uptodate copy of OS X "tiger".
$ uname -a
Darwin lubyanka.local 8.6.0 Darwin Kernel Version 8.6.0: Tue Mar  7 16:58:48 PST 2006; root:xnu-792.6.70.obj~1/RELEASE_PPC Power Macintosh powerpc

-- 
Ajay Shah                                      http://www.mayin.org/ajayshah  
ajayshah at mayin.org                             http://ajayshahblog.blogspot.com
<*(:-? - wizard who doesn't know the answer.



More information about the R-sig-finance mailing list