Skip to content
Prev 279622 / 398506 Next

scatterplotting stock returns using quantmod and pairs()

The names of the list entries are not the same as the column names of
the elements of the list (if that makes any sense)...you need to add
them manually after the merge: this works

library(quantmod)
tickers <- c("SHY","TLT","SPY","IWM","GLD","IEV")
getSymbols(tickers)
AdjCloseReturns <- do.call(merge, lapply(tickers, function(x)
dailyReturn(Ad(get(x)))))
names(AdjCloseReturns) <- tickers

pairs(as.matrix(AdjCloseReturns))

Michael
On Tue, Dec 6, 2011 at 7:36 PM, alan lapedes <asl87501 at earthlink.net> wrote:
Message-ID: <CAAmySGPO8bmdiwu=NP12M0hsDESp_irDUS67aKXyGpmb+C6mAA@mail.gmail.com>
In-Reply-To: <25158300.1323218195787.JavaMail.root@elwamui-norfolk.atl.sa.earthlink.net>