[R] misleading output after ordering data frame

2004-11-08 Thread bogdan romocea
Dear R users, I have a data frame which I create with read.csv and then order by date: d - na.omit(read.csv(...)) d - d[order(as.Date(as.character(d$Date), format=%d-%b-%y), decreasing=F, na.last=F),] My problem is that even though the data frame is ordered as requested, the old row

Re: [R] misleading output after ordering data frame

2004-11-08 Thread Thomas Lumley
On Mon, 8 Nov 2004, bogdan romocea wrote: My problem is that even though the data frame is ordered as requested, the old row numbers are preserved. For example: * Before sorting: d[1:3,] Date Amt 1 5-Nov-04 87.07 2 4-Nov-04 85.80 3 3-Nov-04 82.90 * After sorting: d[1:3,] Date Amt

Re: [R] misleading output after ordering data frame

2004-11-08 Thread Prof Brian Ripley
It's your misinterpretion that is misleading, not the output. Data frames have row *names* and not *numbers*. On Mon, 8 Nov 2004, bogdan romocea wrote: Dear R users, I have a data frame which I create with read.csv and then order by date: d - na.omit(read.csv(...)) d -

Re: [R] misleading output after ordering data frame

2004-11-08 Thread Rolf Turner
You wrote: Is there a way to update the row numbers as well? It's not that important, but I find it a bit confusing. They're not actually row numbers, they're row ***names***. These default to row numbers. If they were real-live names you'd want them to be