Skip to content
Prev 58530 / 63421 Next

order function called on a data.frame?

Hello,

There is a result with lists? I am getting


order(list(letters, 1:26))
#Error in order(list(letters, 1:26)) :
#  unimplemented type 'list' in 'orderVector1'

order(data.frame(letters, 1:26))
# [1] 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
#[22] 48 49 50 51 52  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
#[43] 17 18 19 20 21 22 23 24 25 26


And I agree that order with data.frames should give a warning. The 
result is indeed useless:

data.frame(letters, 1:26)[order(data.frame(letters, 1:26)), ]


Hope this helps,

Rui Barradas


?s 00:19 de 18/05/20, Jan Gorecki escreveu: