Date column in downloaded date
Comments inline.
On Oct 24, 2011, at 1:43 AM, ajc <arkosark at gmail.com> wrote:
Hi All: If I download yahoo data by getSymbols() in R,
from the quantmod package
the date column gets accompanied along with the downloaded data. There is no column header for the date column to access separately.
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.
What is the way to eliminate the date column?
Seems an ill-advised thing to do to a price series but coredata() or as.matrix will do it.
If I want to draw a xy scatter plot with the downloaded price (suppose AAPL vs NASDAQ), I think the date column is creating problem and the plot function is not working.
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?
Please advise on this as I am very new to R. Thanks. -- View this message in context: http://r.789695.n4.nabble.com/Date-column-in-downloaded-date-tp3932125p3932125.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.