I have following dataframe in R
Key Quantity
1_2013 20
1_2013 20
2_2013 20
2_2013 30
3_2013 20
3_2013 20
4_2013 20
4_2013 30
10_2013 20
10_2013 20
11_2013 20
11_2013 30
When I aggregate on Key
column I want to keep the original order of Key
column.
But,when I do group_by
in dplyr it gives me following order
Key Quantity
1_2013 40
10_2013 40
11_2013 50
2_2013 50
3_2013 40
4_2013 50
I want it in following order
Key Quantity
1_2013 40
2_2013 50
3_2013 40
4_2013 50
10_2013 40
11_2013 50
How can I do it in dplyr?