Skip to content

Question about use of sort.list(sort.list(x)) in rank.r

2 messages · Tyler Ritchie, William Dunlap

#
An example:
  > x <- c("E", "B", "C", "A", "F", "G", "D")
  > s <- sort.list(x)
  > s <- as.matrix(sort.list(x))
  > for(i in 2:5) s <- cbind(s, sort.list(s[,ncol(s)]))
  > data.frame(x, s)
    x X1 X2 X3 X4 X5
  1 E  4  5  4  5  4
  2 B  2  2  2  2  2
  3 C  3  3  3  3  3
  4 A  7  1  7  1  7
  5 F  1  6  1  6  1
  6 G  5  7  5  7  5
  7 D  6  4  6  4  6

Note how function(x)sort.list(sort.list(x)) is idempotent, but not
sort.list itself.
  
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com