When using the function initPortf
to initialize portfolio in package blotter
in R,
we can initialize a portfolio, such as:
currency("USD")
stock("SPY",currency="USD",multiplier=1)
b.strategy <- "bFaber"
initPortf(b.strategy,'SPY', initDate='1997-12-31')
But when we want to initialize the portfolio again, we must delete the portfolio b.strategy first:
initPortf(b.strategy, "SPY", initDate = "1997-12-31") :
Portfolio bFaber already exists, use updatePortf() or addPortfInstr() to update it.
the rm()
could not be used here, when I need to delete it, I have to clear all of the workspace. Is there any function to delete it?