R_order - RとLinuxと...

RとLinuxと...


R_order

Rの備忘録

order()は複数の列を指定できる

x <- sample(1:5, 100, rep = T)
y <- sample(1:5, 100, rep = T)
alp <- sample(LETTERS, 100, rep = T)

x.y <- data.frame(name = alp,x = x, y = y)
x.y[order(x.y$name, x.y$x, x.y$y), ]
 
Link: Rの備忘録(1827d)
Last-modified: 2009-03-25 (水) 12:00:48 (3556d)