Skip to content

order

2 messages · tomsv193@student.liu.se, Brian Ripley

#
Hi!

Why is the rows-indicies effected by ordering? 
Example:

(data=)
  name   age
1 peter  13
2 eric   15
3 daniel 14 

#ordering by name...

  name   age
3 daniel 14
2 eric   15
1 peter  13

why not:

  name   age
1 daniel 14
2 eric   15
3 peter  13

Does it effect other operations? data[,1] really gives the 1:st row, 
but when data is printed it says that the first row have index 3...


/Tomas




-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Tue, 3 Jul 2001 tomsv193 at student.liu.se wrote:

            
Those are row names, not row indices.
*row name* 3.  Indices are printed like [3,] as in
[,1] [,2] [,3]
[1,]    1    4    7
[2,]    2    5    8
[3,]    3    6    9


Try a data frame like swiss with real names (in 1.3.0) rather than names
which happen to be 1:nrow(df).