The order function [🇷 for BE/BA]
❝ Man, I never looked at the rank function until now. But it seems to be the important distinction between rank and order that answers my question.
Yep. Don’t know what you want to achieve, but:
L <- c(0.000000, 5161.096198, 18218.849691, 24977.065020,
108495.506990, 114018.413824, 459809.038038, 8691576.342850,
9917785.333365, 6694756.609860)
df <- data.frame(L = L, rk = rank(L))
names(df)[2] <- "rank(L)" # cosmetics
print(df)
L rank(L)
1 0.000 1
2 5161.096 2
3 18218.850 3
4 24977.065 4
5 108495.507 5
6 114018.414 6
7 459809.038 7
8 8691576.343 9
9 9917785.333 10
10 6694756.610 8
print(df[with(df, order(L)), ])
L rank(L)
1 0.000 1
2 5161.096 2
3 18218.850 3
4 24977.065 4
5 108495.507 5
6 114018.414 6
7 459809.038 7
10 6694756.610 8
8 8691576.343 9
9 9917785.333 10
print(df[with(df, order(rank(L))), ]) # same
L rank(L)
1 0.000 1
2 5161.096 2
3 18218.850 3
4 24977.065 4
5 108495.507 5
6 114018.414 6
7 459809.038 7
10 6694756.610 8
8 8691576.343 9
9 9917785.333 10
If you simply want to order the
L
vector, use:L <- L[order(L)]
Dif-tor heh smusma 🖖🏼 Довге життя Україна!
Helmut Schütz
The quality of responses received is directly proportional to the quality of the question asked. 🚮
Science Quotes
Complete thread:
- The order function ElMaestro 2024-03-24 17:07 [🇷 for BE/BA]
- The order function ElMaestro 2024-03-24 20:31
- The order functionHelmut 2024-03-24 21:12
- The order function d_labes 2024-03-26 19:58
- The order function ElMaestro 2024-03-27 08:43
- The sort function Helmut 2024-04-02 10:51
- The sort function ElMaestro 2024-04-02 22:44
- lag-times of profiles and cor() Helmut 2024-04-04 09:39
- Roaster VII/VIII, Bandana Castor, and Effiou ElMaestro 2024-04-04 12:30
- Nomen est omen Helmut 2024-04-04 13:04
- Nomen est omen ElMaestro 2024-04-04 13:50
- Nomen est omen Ohlbe 2024-04-04 14:52
- Nomen est omen ElMaestro 2024-04-04 16:16
- Nomen est omen nobody 2024-04-10 09:21
- Nomen est omen Ohlbe 2024-04-10 09:34
- Nomen est omen nobody 2024-04-10 10:21
- Nomen est omen Ohlbe 2024-04-10 09:34
- Nomen est omen nobody 2024-04-10 09:21
- Nomen est omen ElMaestro 2024-04-04 16:16
- Nomen est omen Ohlbe 2024-04-04 14:52
- Nomen est omen ElMaestro 2024-04-04 13:50
- Nomen est omen Helmut 2024-04-04 13:04
- Roaster VII/VIII, Bandana Castor, and Effiou ElMaestro 2024-04-04 12:30
- lag-times of profiles and cor() Helmut 2024-04-04 09:39
- The sort function ElMaestro 2024-04-02 22:44
- The sort function Helmut 2024-04-02 10:51
- The order function ElMaestro 2024-03-27 08:43
- The order function ElMaestro 2024-03-24 20:31