[R-SIG-Finance] I am using the quantmod package (http://www.quantmod.com) and, using getSymbols,

G See gsee000 at gmail.com
Mon Sep 10 04:02:44 CEST 2012


I assume you did this:

    library(quantmod)
    getSymbols("BBD-B.TO")

If so, then you should have data stored in the .GlobalEnv in an object
named "BBD-B.TO"

You could access it like this
    get("BBD-B.TO")

And you could rename the data with a syntactically valid name like this:

    assign("BBD", get("BBD-B.TO"), pos=.GlobalEnv)
    #assign(make.names("BBD-B.TO"), get("BBD-B.TO"), pos=.GlobalEnv)
    rm("BBD-B.TO")

You have at least 2 other options.

You can use auto.assign=FALSE in the getSymbols call and assign the
results yourself like this:

    BBD <- getSymbols("BBD-B.TO", src='yahoo', auto.assign=FALSE)

Or, you can use setSymbolLookup to associate the name yahoo uses with
a valid name in R

    setSymbolLookup("BBD", list(src='yahoo', name='BBD-B.TO'))
    getSymbols("BBD")

HTH,
Garrett

On Sun, Sep 9, 2012 at 8:29 PM, Jean-Victor Côté
<jean-v.cote at sympatico.ca> wrote:
>
> ...I could not download from Yahoo Finance the quotes for "BBD-B.TO", a common stock traded on the Toronto Stock Exchange.  I guess that it is because of the "-" and the ".".
>
> Jean-Victor Côté
>
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.



More information about the R-SIG-Finance mailing list