Sorting Data in a Data Frame in R

Problem:

Sorting Data in a Data Frame in R

Solution:

To sort a Data Frame in R, we need to use the order( ) function.


For Example:

We can use the built-in data Frame mtcars for this. By default, the sorting is in Ascending order. To sort the Data Frame in Descending order, we need to add a minus sign before the sorting column.

Read Further:

Creating a Data Frame in R

Accessing Data Frame Elements in R

Import a CSV Data Set as a Data Frame using R Syntax

Happy Coding!

0

2 comments

  1. Unknown

    I appreciate your work on Data Science. It's such a wonderful read on Data Science course. Keep sharing stuffs like this. I am also educating people on similar Data Science training so if you are interested to know more you can watch this Data Science tutorial:-https://www.youtube.com/watch?v=gXb9ZKwx29U&t=237s

Leave a Reply

Your email address will not be published. Required fields are marked *