R
Robir
I need to sort a list of integers (with associated text values) in ascending
order.
The input would look like this:
25 Jim
75 Ellen
15 Bob
497 Steve
23 Doris
The output needs to look like this
1 Bob
2 Doris
3 Jim
4 Ellen
5 Steve
So, three things need to happen to the input in order to create the desired
output:
(1) the integers need to be sorted in ascending order.
(2) the integers need to be re-numbered so there are no "gaps" between
values (e.g., input 15/Bob becomes output 1/Bob)
(3) the new output integer values need to remain associated with their
original input text.
The largest input integer value is 9999. The lowest input value is 1 (any
input value < 1 must be ignored).
Suggestions for accomplishing this will be greatly appreciated.
Robir
order.
The input would look like this:
25 Jim
75 Ellen
15 Bob
497 Steve
23 Doris
The output needs to look like this
1 Bob
2 Doris
3 Jim
4 Ellen
5 Steve
So, three things need to happen to the input in order to create the desired
output:
(1) the integers need to be sorted in ascending order.
(2) the integers need to be re-numbered so there are no "gaps" between
values (e.g., input 15/Bob becomes output 1/Bob)
(3) the new output integer values need to remain associated with their
original input text.
The largest input integer value is 9999. The lowest input value is 1 (any
input value < 1 must be ignored).
Suggestions for accomplishing this will be greatly appreciated.
Robir