I would like to reorder this dataframe based on the values โโof the "new" column, how can I do? tell me the exact formula, thanks
Asked
Active
Viewed 45 times
-1
-
Welcome to SO, Nabboitaliae! Two things, please: (1) Please do not post an image of code/data/errors: it breaks screen-readers and it cannot be copied or searched (ref: https://meta.stackoverflow.com/a/285557 and https://xkcd.com/2116/). Please just include the code, console output, or data (e.g., `data.frame(...)` or the output from `dput(head(x))`) directly. โ r2evans Feb 02 '22 at 22:39
-
And (2) Please go back to your [previous questions](https://stackoverflow.com/users/17580026/nabboitaliae?tab=questions) and review them. For each, if any answer has solved your question please consider [accepting it](https://meta.stackexchange.com/q/5234/179419) (also [read](https://stackoverflow.com/help/someone-answers)) by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. (There is no obligation to do this.) โ r2evans Feb 02 '22 at 22:39
1 Answers
0
Substituting "DF" as your data frame, you can use this line of code:
DF[order(DF$new), ]
If you just wanted to view the data frame sorted, you can use
View(DF)
And click the arrows on the column name, which automatically sorts the data frame by ascending/descending.
typhatypha
- 16
- 1