I have a df:
df = data.frame(a = c(1, 2, 3), b = c(3, 2, 1))
I subset the df like so:
df = df[2:3, ]
Now, when I check df as follows:
> df
a b
2 2 2
3 3 1
the first value has a number 2, and the second number has a number 3. How can I subset the original df in a way that the new subset will have ordered numbers?
Desired output:
> df
a b
1 2 2
2 3 1