[R] Accessing DF index

eric ericstrom at aol.com
Sat Feb 19 22:50:04 CET 2011


I have a dataframe called x2. It seems to have a date column but I can't
access it or give it a name or convert it to a date. How do I refer to that
first column and make it a date ? When I try x2[1,] I get the second column.

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

x[1,1]
                FAIRX
2000-08-31 0.01010110

x[1,2]
                 SP500
2000-08-31 0.007426964

str(x2)
'data.frame':	127 obs. of  3 variables:
 $ FAIRX: num  0.0101 0.09668 -0.00825 0.03702 0.08004 ...
 $ SP500: num  0.00743 -0.05497 -0.00496 -0.08346 0.00405 ...
 $ delta: num  0.00267 0.15165 -0.00328 0.12048 0.076 ..
-- 
View this message in context: http://r.789695.n4.nabble.com/Accessing-DF-index-tp3314649p3314649.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list