[R-SIG-Finance] Removing instruments...

G See gsee000 at gmail.com
Tue Sep 18 13:59:52 CEST 2012


Hi Worik,

Either of these will do it
    rm_exchange_rates("AUDCAD")
    rm_instruments("AUDCAD", keep.currencies=FALSE)

The reason rm_instruments has a keep.currencies argument is because I
was frustrated that currencies have to be defined before anything
else.  So, I made it a little more work to delete them.  exchange_rate
instruments get treated like currencies because they inherit the
'currency' class (although, personally, I don't think they should).

You could also backup your .instrument environment before
experimenting, then reload it.

You could either back it up by saving it via saveInstruments(), or,
simply convert it to a list and assign it to something.

    tmppdir <- tempdir()
    saveInstruments("test", dir=tmpdir)

    bak <- as.list(FinancialInstrument:::.instrument, all.names=TRUE)

Now, you can revert to a backed up version like this

    reloadInstruments('test', dir=tmpdir)

or

    reloadInstruments(bak)


reloadInstruments(bak) is equivalent to
    rm_instruments(keep=FALSE)
    loadInstruments(bak)

HTH,
Garrett

On Mon, Sep 17, 2012 at 11:09 PM, Worik Stanton <worik.stanton at gmail.com> wrote:
> I have been playing with exchange_rate(..)
>
> Having called, for example,
>
> currency("CAD")
> currency("AUD")
> exchange_rate("AUDCAD", currency="CAD", counter_currency="AUD")
>
> All good so far.
>
> How do I delete the exchange_rate AUDCAD when I am done with it?
>
> cheers
> Worik
>
> --
> it does not matter                      I think that I shall never see
> how much I dig and dig                    A billboard lovely as a tree
> this hole just                      Indeed, unless the billboards fall
> keeps getting deeper                      I'll never see a tree at all
>
> _______________________________________________
> 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