order - getting largest values per row in R -


i trying rank values of row. trying see value largest, second largest etc etc.

here simple example:

test = c(0.005,0.007,0.009,-0.0008,0.5,-0.074) order(test) [1] 6 4 1 2 3 5 which.max(test) [1] 5 

the function which.max correctly gives me column largest value, doesn't give me second largest, third largest etc., etc.

i believed use function order this, output of doesn't seem correct.

what doing wrong?

you have use decreasing parameter:

> order(test,decreasing=t) [1] 5 3 2 1 4 6 

or alternatively reverse it:

> rev(order(test)) [1] 5 3 2 1 4 6 

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -