Re: [R] Accessing DF index

2011-02-19 Thread Prof Brian Ripley
On Sat, 19 Feb 2011, David Winsemius wrote: On Feb 19, 2011, at 4:50 PM, eric wrote: 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

Re: [R] Accessing DF index

2011-02-19 Thread David Winsemius
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 ? You could have used subset without the new column: > subset(x2, rownames(x2) < "2000-11-30")

Re: [R] Accessing DF index

2011-02-19 Thread David Winsemius
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 FAIRXSP500delta

Re: [R] Accessing DF index

2011-02-19 Thread eric
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 ? -- View this message in context: http://r.789695.n4.nabble.com/Accessing-DF-index-tp3314649p3314689.html Sent from the R help mailing list archiv

Re: [R] Accessing DF index

2011-02-19 Thread David Winsemius
On Feb 19, 2011, at 4:50 PM, eric wrote: 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. It is not actually

[R] Accessing DF index

2011-02-19 Thread eric
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) FAIRXSP500delta 2000-08-31