[R] Accessing DF index

David Winsemius dwinsemius at comcast.net
Sat Feb 19 23:57:46 CET 2011


On Feb 19, 2011, at 5:25 PM, eric wrote:

>
> So how would I convert those row names to dates and give that column  
> the name
> "Date" so that I can use subset and other functions on the Date  
> column ?

 > x2$dtcol <- as.Date(rownames(x2))
 > x2
                   FAIRX        SP500        delta      dtcol
2000-08-31  0.010101096  0.007426964  0.002674132 2000-08-31
2000-09-29  0.096679730 -0.054966292  0.151646023 2000-09-29
2000-10-31 -0.008245580 -0.004961785 -0.003283795 2000-10-31
2000-11-30  0.037024545 -0.083456134  0.120480679 2000-11-30
2000-12-29  0.080042708  0.004045193  0.075997514 2000-12-29
2001-01-31 -0.009042396  0.034050246 -0.043092643 2001-01-31

> -- 
> View this message in context: http://r.789695.n4.nabble.com/Accessing-DF-index-tp3314649p3314689.html
> Sent from the R help mailing list archive at Nabble.com.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list