I used quantmod to pull in price data from the ticker SPY.  The data has
date and closing price.  I would like to show the day of the week for each
closing price.  Is that possible?  Also, I would like to add the back into
the data frame in a new column without changing the structure of the data
set if possible.  

 

             SPY

2009-01-02 92.96

2009-01-05 92.85

2009-01-06 93.47

2009-01-07 90.67

2009-01-08 91.04

2009-01-09 89.09

 

> str(SP500)

An 'xts' object from 2009-01-02 to 2012-07-31 containing:

  Data: num [1:902, 1] 93 92.8 93.5 90.7 91 ...

- attr(*, "dimnames")=List of 2

  ..$ : NULL

  ..$ : chr "SPY"

  Indexed by objects of class: [Date] TZ:  

  xts Attributes:  

List of 4

$ tclass : chr [1:2] "POSIXct" "POSIXt"

$ tzone  : chr ""

$ src    : chr "yahoo"

$ updated: POSIXct[1:1], format: "2012-07-31 17:59:16"

 

Thank you,

Douglas

 


        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to