Skip to content
Prev 10725 / 15274 Next

I am using the quantmod package (http://www.quantmod.com) and, using getSymbols,

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: