1

I have a dataframe with 3 columns. 1st column is the row id; the 2nd is the group_ID (eg : "T40" "T50" "T100" etc); the 3rd column is the value.

ID      GROUP_ID       VALUE
1       T40            0.56
2       T40            15
1       T50            45
2       T50            15
1       T100           0.3
2       T100           0.78
NA      T40            NA
NA      T50            NA
NA      T100           NA

I want to regroup all my rows like this :

ID      GROUP_ID       VALUE
1       T40            0.56
2       T40            15
NA      T40            NA
1       T50            45
2       T50            15
NA      T50            NA
1       T100           0.3
2       T100           0.78
NA      T100           NA

The issue that i have is when i try regroup my row, my group get sorted in a wrong order. I tried group_by() or arrange() but each time they would sort the group "T100" before the group "T40"

ID      GROUP_ID       VALUE
1       T100           0.3
2       T100           0.78
NA      T100           NA
1       T40            0.56
2       T40            15
NA      T40            NA
1       T50            45
2       T50            15
NA      T50            NA
keyser
  • 11
  • 2

0 Answers0