rownames()- is what you want.
dat-data.frame(V1=sample(10),V2=sample(10))
dat
V1 V2
1 2 5
2 3 8
3 8 4
4 9 6
5 6 2
6 5 7
7 10 3
8 4 9
9 1 10
10 7 1
dat-dat[order(dat$V2),]
dat
V1 V2
10 7 1
5 6 2
7 10 3
3 8 4
1 2 5
4 9 6
6 5 7
2 3 8
8 4
Sorry, no: row.names-() is what you want.
rownames for matrices (and arrays)
row.names for data frames.
Using them the other way round usually works but can be very inefficient.
From R-devel (where the worst inefficiencies are circumvented)
The extractor functions try to do something
I did not know the fact.
Thanks for useful information.
On 1/24/07, Prof Brian Ripley [EMAIL PROTECTED] wrote:
Sorry, no: row.names-() is what you want.
rownames for matrices (and arrays)
row.names for data frames.
Using them the other way round usually works but can be very inefficient.