Skip to content
Prev 275331 / 398506 Next

Date column in downloaded date

Comments inline.
On Oct 24, 2011, at 1:43 AM, ajc <arkosark at gmail.com> wrote:

            
from the quantmod package
The "date column" isn't a column in the same sense that the OHLC data is: rather its a time index which is fundamental to the time series object.
Seems an ill-advised thing to do to a price series but coredata() or as.matrix will do it.
plot() is working as it should, but I think you are getting tripped up on R's method-dispatch/S3 system. Without code I can't be sure what you've tried but I'd guess you did something like

plot(AAPL, NASDAQ)

R notes that the first input is an xts so it automatically calls plot.xts(), which is a plot method for xts objects. plot.xts() throws an error/warning (can't remember which right now) because there's no sensible way to plot two time series against each other qua time series. Rather try this:

plot( coredata(Cl(AAPL)), coredata(Cl(NASDAQ)) )

This strips the time-series-ness from the close series and should produce the desired scatterplot. Offtopic, isn't this graph usually done in return space?