Hi All: If I download yahoo data by getSymbols() in R, the date column gets accompanied along with the downloaded data. There is no column header for the date column to access separately. What is the way to eliminate the date column? 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. 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.
The date column is very unlikely to interfere with your plots if you don't specify it. I suggest you follow the instructions at the bottom of this and every other message on this mailing list. (Hint: reproducible code and identify your software platform.) --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil@dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. ajc <arkosark@gmail.com> wrote: Hi All: If I download yahoo data by getSymbols() in R, the date column gets accompanied along with the downloaded data. There is no column header for the date column to access separately. What is the way to eliminate the date column? 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. 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@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. [[alternative HTML version deleted]]
R. Michael Weylandt <michael.weylandt@gmail.com>
2011-Oct-24 14:32 UTC
[R] 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.