I have a large data frame of bond data, like that:
ISIN CF DATE
1 A 105.750 2016-09-30
2 B 104.875 2016-05-31
3 C 106.875 2017-02-13
4 D 103.875 2016-10-07
5 E 5.000 2016-04-21
6 E 5.000 2017-04-21
7 E 5.000 2018-04-21
8 E 5.000 2019-04-21
9 E 105.000 2020-04-21
10 F 7.800 2016-09-09
11 F 7.800 2017-09-09
12 F 7.800 2018-09-09
13 F 7.800 2019-09-09
14 F 107.800 2020-09-09
I want to group the elements by the ISIN code, then sort the Dates within the groups in increasing order (already done in the example above), then I want to sort the groups (A, B, C, D, E,F in this example) such that the group with the earliest date comes first, then the group with the second earliest date and so on.
I want it to look like this:
ISIN CF DATE
16 E 5.000 2016-04-21
15 E 5.000 2017-04-21
14 E 5.000 2018-04-21
13 E 5.000 2019-04-21
12 E 105.000 2020-04-21
7 B 104.875 2016-05-31
10 F 7.800 2016-09-09
11 F 7.800 2017-09-09
12 F 7.800 2018-09-09
13 F 7.800 2019-09-09
14 F 107.800 2020-09-09
6 A 105.750 2016-09-30
23 D 103.875 2016-10-07
22 C 106.875 2017-02-13
I tried something like this from this question:
df<-df[order(df$ISIN,df$DATE ),]
But it doesn't do what I want.
I don't want
Thanks for helping!